In the Bundle, why the key is constant? what is the benefit of using constant rather than write it directly in the code.
For example, why the following is used:
private static final String KEY_INDEX = "index";
.
.
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
Log.i(KEY_INDEX, "onSaveInstanceState");
savedInstanceState.putInt(KEY_INDEX, mCurrentIndex);
instead of:
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
Log.i(KEY_INDEX, "onSaveInstanceState");
savedInstanceState.putInt(index, mCurrentIndex);