(I know final
can't be changed. But if you read the example I have typed, you can understand why I am asking this question!)
I am reading the example hello world Android app:
MainActivity.java
public final static String EXTRA_MESSAGE = "com.example.helloworld.MESSAGE";
....
....
intent.putExtra(EXTRA_MESSAGE, message);
How does it work? Are we storing the message value in EXTRA_MESSAGE?
Additionally, how many SharedPreferences can I have to store data? Assuming that, my app needs to store the levels and high scores, how do I do that?
public final static String HIGH_SCORE = "com.example.helloworld.HIGH_SCORE";
public final static String LEVELS = "com.example.helloworld.LEVELS";
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt(getString(R.string.saved_high_score), newHighScore);
editor.commit();
How do I change the above lines to save the levels and scores?