Re: [android-developers] Re: onCreateOptionsMenu being hit too many times

2013-02-09 Thread FiltrSoft
Oh, I gotcha. I see where I'm wrong, instead of creating a collection of Fragments, I should create a collection of id's and do something like this in getItem(): @Override public Fragment getItem(int index) { if (index == 0) return MyList

Re: [android-developers] Re: onCreateOptionsMenu being hit too many times

2013-02-09 Thread Mark Murphy
The tutorial you link to does what I described: it creates the fragments on demand from getItem() of the adapter. On Sat, Feb 9, 2013 at 5:22 PM, FiltrSoft wrote: > So, should I re-think how I'm setting up my ViewPager? This is the first > time I've implemented one, so I was a little in the dark

Re: [android-developers] Re: onCreateOptionsMenu being hit too many times

2013-02-09 Thread FiltrSoft
So, should I re-think how I'm setting up my ViewPager? This is the first time I've implemented one, so I was a little in the dark on the best practices. I was using this tutorial as base for what I needed to do: http://tamsler.blogspot.com/2011/10/android-viewpager-and-fragments.html On Satur

Re: [android-developers] Re: onCreateOptionsMenu being hit too many times

2013-02-09 Thread Mark Murphy
Well, normally, you don't even need to do that. FragmentPagerAdapter/FragmentStatePagerAdapter use the tag to determine what fragment goes in what page. So your pages will automatically reappear after the configuration change. This is why most samples do not do what you are doing, creating fragment

[android-developers] Re: onCreateOptionsMenu being hit too many times

2013-02-09 Thread FiltrSoft
Ah, that makes sense. I knew it might have been related to something with Fragments I didn't understand as I am new to them. The only thing I'm not sure if is, I can use findFragmentById to retrieve the MyListFragment, but the MyDetailFragment would have the same id, with a different argument,