android - Saving state of activity on orientation change using different Layouts? -


i using 2 different layouts same activity, on orientation change activity state not maintained. please suggest how that?

you can store "activity state" using onsavedinstancestate. example:

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     if(saveinstancestate != null) {         if(savedinstancestate.getboolean("running") == true) {             // running          } else {          // not running          }     } }   @override protected void onsaveinstancestate(bundle outstate) {     super.onsaveinstancestate(outstate);     if(condition) {         outstate.putboolean("running", true);     } } 

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -