i m using pageviewer with FragmentPagerAdapter , every page is a fragment. in each fragment i have a thread. i want on current page-fragment to run a thread that refresh some view of the fragment. when i change page i want to stop the thread of the fragment page that is no longer the current page and i want to start the thread of new fragment-page. where can i insert the “start thread” and “stop thread” in my code ? the problem is that i cant insert them in fragment life method because fragmentpageradapter create not only current fragment but also the next fragment(example when the current page is the “0” ,every method life of fragment of pag “0” and pag “1” is executed ex:onAttach,onCreateView ecc …
please help me sorry for my english
i m using pageviewer with FragmentPagerAdapter , every page is a fragment. in each
Share
You could do this implementing your threads in your activity and start threads in onAtach and stop it in onDetach fragment callbacks.