java - Preserve edittext entry after pressing onOptionsItemSelected -
hello have reverse of this problem, entries disappear.
i want retain entries in edittext after selecting menu button. here code. have pass intents if want preserve information?
public boolean onoptionsitemselected(menuitem item){ switch(item.getitemid()){ case r.id.seesavedroutes: intent launchnewintent = new intent(mainactivity.this,savedroutes.class); startactivityforresult(launchnewintent, 0); super.onpause(); onpause(); return true; } return false; }
you shouldn't explicit call onpause
, called android system. android widgets save , restore state default (note: in order android system restore state of views in activity, each view must have unique id, supplied android:id attribute.). may save additional state (or state of views without id) in onsaveinstancestate
, restore in oncreate(bundle)
or in onrestoreinstancestate(bundle)
.
please, read: this , this
Comments
Post a Comment