android - How do I save the state of my activity -


how save way activity when closed button , resumed same way when closed.

this activity code:

public class levels extends activity{

@override protected void oncreate(bundle savedinstancestate) {     // todo auto-generated method stub     super.oncreate(savedinstancestate);     settheme(android.r.style.theme_notitlebar_fullscreen);     setcontentview(r.layout.levels);      final edittext anstext1 = (edittext) findviewbyid(r.id.anstext1);     button button1 = (button) findviewbyid(r.id.button1);      button1.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v) {                 string result = anstext1.gettext().tostring();              if(result.equals("they"))                  setcontentview(r.layout.social);              else                 toast.maketext(getapplicationcontext(), "wrong", toast.length_long).show();         }     });     } 

}

in onsaveinstancestate() method can add data bundle , when oncreate() called can grab previous values bundle.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -