java - TextView Disappears after Screen Rotation -


i new savedinstancestate. there great resources out there, , have figured out. however, textview updates want to, disappears. want remain there when rotate device instead of having click button bring back. idea on going wrong? thanks!

textview cashview want see int cash.

@override     public void onsaveinstancestate(bundle savedinstancestate) {       super.onsaveinstancestate(savedinstancestate);       // save ui state changes savedinstancestate.       // bundle passed oncreate if process       // killed , restarted.       savedinstancestate.putint("cash", cash);       savedinstancestate.putint("antebet", antebet);       savedinstancestate.putint("playbet", playbet);       savedinstancestate.putint("pairplusbet", pairplusbet);       savedinstancestate.putstring("cashview", cashview.tostring());       // etc.     }  @override public void onrestoreinstancestate(bundle savedinstancestate) {   super.onrestoreinstancestate(savedinstancestate);   // restore ui state savedinstancestate.   // bundle has been passed oncreate.   cash = savedinstancestate.getint("cash");   antebet = savedinstancestate.getint("antebet");   playbet = savedinstancestate.getint("playbet");   pairplusbet = savedinstancestate.getint("pairplusbet");   cashview.settext(savedinstancestate.getstring(cashview.tostring())); } 

haha...after hour of fiddling it, figured out finished asking question. time though!

@override public void onsaveinstancestate(bundle savedinstancestate) {   super.onsaveinstancestate(savedinstancestate);   // save ui state changes savedinstancestate.   // bundle passed oncreate if process   // killed , restarted.   savedinstancestate.putint("cash", cash);   savedinstancestate.putint("antebet", antebet);   savedinstancestate.putint("playbet", playbet);   savedinstancestate.putint("pairplusbet", pairplusbet);   savedinstancestate.putstring("cashview", cashview.gettext().tostring());   // etc. }  @override public void onrestoreinstancestate(bundle savedinstancestate) {   super.onrestoreinstancestate(savedinstancestate);   // restore ui state savedinstancestate.   // bundle has been passed oncreate.   cash = savedinstancestate.getint("cash");   antebet = savedinstancestate.getint("antebet");   playbet = savedinstancestate.getint("playbet");   pairplusbet = savedinstancestate.getint("pairplusbet");   cashview.settext(savedinstancestate.getstring("cashview")); } 

i changed savedinstancestate.putstring("cashview", cashview.tostring()); savedinstancestate.putstring("cashview", cashview.gettext().tostring());

and changed cashview.settext(savedinstancestate.getstring(cashview.tostring())); cashview.settext(savedinstancestate.getstring("cashview"));

not sure 1 fixed it, fixed. anyways!


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -