java - how to avoid Listview data is clearing while switching from same activity to another -


i using adapter data stored in arraylist , added in adapter,hence calling adapter in ui thread,hence adapter calls when user clicks start button.when user switch activity same , returning same activity list view got cleared. button function ,while clicking start service.

intent start_service = new intent(mytrip.this, applocationservice.class); startservice(start_service); 

hence call adapter every 5min

my adapter

adapter = new mytrip_listview_adapter(mytrip.this, location, date_array, imagesview, j, context, arrayplaces); listviewplace.setadapter(adapter); listviewplace.setselection(location.size() - 1); adapter.notifydatasetchanged(); 

i think i've understood you.

you need when come activity, don't lose data on listview, isn't it?

ok, have handle this:

public boolean onoptionsitemselected(menuitem menuitem) { switch (menuitem.getitemid()) {     case android.r.id.home:         intent homeintent = getintent();         startactivity(homeintent); } return (super.onoptionsitemselected(menuitem)); 

i can not try on ide because i'm out, think way.

if doesn't work, let me know.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -