To wrap this up, I've found that the arguments "sent" to the fragment
with setArguments are preserved when the fragment is reinstantiated by
the framework. So what I'm now doing is only creating a new fragment
if there is no previous one after a config-change restart. For
example:


    mTabBar = (TabBarFrag) fm.findFragmentByTag(PERS_TAB_TAG);

    if (mTabBar == null) {
        mTabBar = TabBarFrag.newInstance(R.id.tab_pers);
    }

    ft.add(R.id.tab_bar, mTabBar, PERS_TAB_TAG);

And where the newInstance function contains:

        public static TabBarFrag newInstance(int dsbId) {
                TabBarFrag frag = new TabBarFrag();
                Bundle args = new Bundle();
                args.putInt(DISABLE_ID, dsbId);
                frag.setArguments(args);
                return frag;
        }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to