android - Fragment Transaction Commit: State Loss in OnClick? -


i still dont seem state loss error when commiting fragment. have listview onclicklistener:

public void onlistitemclick(listview l, view v, int position, long id) {     switch (position) {         case 0:            fragmenttabactivity.addfragments(maintabhostactivity.gettabnames()[0], new openerlocationlistfragment(), true);            break;     } } 

and addfragments method:

    public void addfragments(string tabname, fragment fragment, boolean add) {     if (add) {         hmaptabs.get(tabname).add(fragment);     }      fragmentmanager manager = getsupportfragmentmanager();     fragmenttransaction ft = manager.begintransaction();      ft.replace(android.r.id.tabcontent, fragment);     ft.commit(); } 

how can lose state in short time frame? can understand why happens in asynctasks should different here (other allowing state loss)? has suggestions?


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -