Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


tmccolgan88

Member Since 05 May 2013
Offline Last Active Oct 27 2014 10:32 AM

Posts I've Made

In Topic: Saving a persistent .txt file

09 April 2014 - 07:40 AM

Yup. My if that called the function in true was wrong.

In Topic: Saving a persistent .txt file

07 April 2014 - 04:56 PM

For some reason my code is always returning the fail safe number. I just noticed that it wasn't actually working correctly.

public int readScores(){
			
			SharedPreferences data = getSharedPreferences("LIFETIME_GAME_DATA_2", Activity.MODE_PRIVATE);
			int bestScore = data.getInt("BEST_SCORE", 3);
		    Log.d("Best Score", String.valueOf(bestScore));
			return bestScore;
	
		}
		public void saveGame(int score){
		
			SharedPreferences data = getSharedPreferences("LIFETIME_GAME_DATA_2", Activity.MODE_PRIVATE);
		
			if (score > readScores())		
				data.edit().putInt("BEST_SCORE", score).apply();
		}

This is how my code looks now. I can't seem to figure out what I'm doing wrong.


In Topic: Saving a persistent .txt file

05 April 2014 - 02:25 AM

Hello TechnoGoth. Ive read the link you posted a few times but it didn't seem to help.  The

SharedPreferences

 class seems to work perfectly though. 


In Topic: Saving a persistent .txt file

01 April 2014 - 06:38 AM

As it is Android, did you your permissions include the right to modify storage?

 

Hey frob. All the documentation that I can find says that when saving to internal storage you don't need to declare permissions. I went ahead and tried the code with and without perms when it wouldn't work though.


In Topic: Is gaming on console dying?

02 November 2013 - 09:53 AM

 

No gaming platform is dying.

Well, except maybe BlackBerry OS as a gaming platform...

 

 

This made me laugh.


PARTNERS