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 <[email protected]> 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 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 Saturday, February 9, 2013 4:56:57 PM UTC-5, Mark Murphy (a Commons Guy)
> wrote:
>>
>> 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 fragments in the
>> activity and forcing them into the adapter. Instead, the adapter
>> creates fragments *on demand* only when needed in the call to
>> getItem().
>>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.5 Available!

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to