used intent from a button click to go to another activity and then later return back to the original activity.
i tried to save two integers on leaving the activity for the other activity, then later when i return back to the original activity i get a null for the bundle.
does anyone know why this is not working?
i used savedInstanceState bundle to save variables on screen rotation and it works in this situation, however when i leave to view another activity and later return back to this activity the bundle was not saved. getting null on return.
the onSavedInstanceState method
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
outState.putInt("index", index);
outState.putInt("top", top);
} // end onSavedInstanceState
the first part of the onCreate method containing the code for getting the savedInstatnceState saved variables
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inspectioninfoselectionlist);
if(savedInstanceState!=null){
index = savedInstanceState.getInt("index");
top = savedInstanceState.getInt("top");
Log.i("$$$$$$$", "value of index and top returned after activity starts" + index + " " + top);
}else if (savedInstanceState == null){
Log.i("$$$$$$$", "saved instance state is null" + index + " " + top);
}