android - Why does my savedInstanceState Bundle not preserve values? -


i making fitness app allows users make lists of fitness events. 1 of options when making new event select location using google map. opens new fragment, , causes values on current fragment reset. prevent happening, save values have been set using onsaveinstancestate():

@override public void onsaveinstancestate(bundle outstate) {     super.onsaveinstancestate(outstate);     if (meventstr != null)         outstate.putstring("event", meventstr);     if (mselectstartdatetxtvw != null)         outstate.putstring("startdate", mselectstartdatetxtvw.gettext().tostring());     if (mselectstarttimetxtvw != null)         outstate.putstring("starttime", mselectstarttimetxtvw.gettext().tostring());     if (mselectenddatetxtvw != null)         outstate.putstring("enddate", mselectenddatetxtvw.gettext().tostring());     if (mselectendtimetxtvw != null)         outstate.putstring("endtime", mselectendtimetxtvw.gettext().tostring());     if (meventtype != null)         outstate.putstring("eventtype", meventtype);     if (meventdescriptionedtxt != null)         outstate.putstring("eventdescription", meventdescriptionedtxt.gettext().tostring()); } 

then, when user has returned google map, restore these values in oncreateview():

if (savedinstancestate != null) {     meventstr = savedinstancestate.getstring("event");     mselectstartdatetxtvw.settext(savedinstancestate.getstring("startdate"));     mselectstarttimetxtvw.settext(savedinstancestate.getstring("starttime"));     mselectenddatetxtvw.settext(savedinstancestate.getstring("enddate"));     mselectendtimetxtvw.settext(savedinstancestate.getstring("endtime"));     meventtype = savedinstancestate.getstring("eventtype");     meventdescriptionedtxt.settext(savedinstancestate.getstring("eventdescription")); } 

this, however, not seem work. have idea of why may happening?

call super.onsaveinstancestate(outstate); @ end of method


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -