android - Sliding Tab is reloading Fragment after changing Tab -
im using these classes tabs:
i have 3 tabs : tab1 tab2 , tab3.
in tab3 im loading contacts phone , add them listview.this takes while till loaded successfuly (200 contacts).
now problem : when change tab tab3 tab1 loading process begins again.so fragment loading 0 again.
so everytime change tab 1 , go tab 3 has loaded again. got idea find solution ? how can prevent fragment reload ?
@override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { view v = inflater.inflate(r.layout.tab_friends, container, false); lv_contacts = (listview)v.findviewbyid(r.id.lv_contacts); if(adapter_contacts == null) new load_contacts().execute(); return v; } edit: when change tab3 tab2 working fine.it continues when go tab1 starts beginning , builds listview again
all need add this
viewpager.setoffscreenpagelimit(3); for more detail read doc
Comments
Post a Comment