mercredi 29 juin 2016

Start Fragment before hand

I have a parent fragment P which contains 10 buttons each on clicking will replace a container in P with child fragments C1 to C10. I should also be able to navigate from C1 to C2 on clicking next in action bar. I am able to achieve this but since each of the child fragment is having a heavy initialization (loading SVG, surfaceview etc..) the transition is not smooth. Is it possible to start the next fragment i.e. C2 when in C1 and put it in paused state so that it can be resumed directly when next in C1 is clicked.

This is someway similar to OffScreenLimit in ViewPager but when I have seen the view pager source code it doesn't replace the existing fragment but simply scroll the view to new fragment X.

Replacing the existing framework with ViewPager as shown here is one possible solution but that requires a lot of changes with the existing code base and is the last thing I wish to do

Aucun commentaire:

Enregistrer un commentaire