java - Change from one Activity to another -


so trying implement to-do list when click on item on list-view need go activity. code:

textview tvitem = (textview) findviewbyid(r.id.tvitem);  tvitem.setonclicklistener(new onclicklistener() {      @override     public void onclick(view v) {         intent = new intent(new intent(mainactivity.this, itemview.class)) ;            startactivity(it);      } 

please help

to go ne next activity add onitemclicklistner:

intent intent = new intent(this, activitytwo.class); this.startactivity (intent); 

all saving of tha activity must made on overriden method

@override public void onsaveinstancestate(bundle savedinstancestate) {   super.onsaveinstancestate(savedinstancestate);    savedinstancestate.putboolean("myboolean", true);   savedinstancestate.putdouble("mydouble", 1.9);   savedinstancestate.putint("myint", 1);   savedinstancestate.putstring("mystring", "welcome android");   // etc. } 

the savedinstancestate bundle passed again activty in it's oncreate method can retreive values again reassigned them were.

if eveything set correctly, go previous activity need call finish() on current activity.

hope helped!


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -