I'm making an app with 4 main Views. I want that all of them stay on a LIST menu on top (That's ok for now).
Using Fragments, I have the ability to change the view without actualy going to other activity, but since one of my Views have a ViewPager, it's NOT working at all (When I first load the view, the content is OK, but on the seccond time, views on the ViewPager disapear, and appear only if I go 2 index positions away, and go back) (See picture, shown for the first load time, and seccond)
Note that the ViewPager IS NOT to show de menu's items, it's in fact, part of the Fragment of the current menu item (in this case, "Simula'c~ao")
My question is: Is this a known issue, is there a simple way to fix it, or I must do it in another way? I already searched for this problem on the internet, but nothing worked for me (invalidating, setting up the on getItemPosition
to return POSITION_NONE
...)
I have looked into the ViewPager class, and everything seems to be OK, I have modified it, so that everytime I render the views, it forces to render everything, but neither this way worked.
I have tried to set visibility to GONE and VISIBLE
I have tried to detach and attach the adapter
Tried to cache the views, and return cached.
One thing that semmed to work: Changing the orientation of the Phone. That worked.
Tried lots of things that I even remember... I'm a little furious with this, because the past 24 hours didn't helped me to solve this "mistery" at all. I hope that some of you can =]
My code: https://www.dropbox.com/s/u4mlxr3k6ta9yrm/MainActivity.java https://www.dropbox.com/s/2dqfnzjs2wl89hj/SimulationFragment.java
Views: https://www.dropbox.com/s/d6ruc1zjovqu6ob/activity_main.xml https://www.dropbox.com/s/lp1iea13klr77iq/activity_simulation.xml https://www.dropbox.com/s/1mkl3jqmo7g4wh8/item_simulation.xml