¡@

Home 

2014/10/16 ¤W¤È 08:21:40

android Programming Glossary: putfragment

When to use FragmentManager::putFragment and getFragment

http://stackoverflow.com/questions/6446961/when-to-use-fragmentmanagerputfragment-and-getfragment

to use FragmentManager putFragment and getFragment I've got an application that uses fragments and I was playing around with how to use the same fragment.. as a stand alone. Still not sure on the best method for completing this but I noticed the FragmentManager has a putFragment and getFragment function. What confuses me is that you have to provide a Bundle as parameter to both get and put functions... at that point I feel like you're just making a mess of things. So what is a good scenario for using getFragment and putFragment Please include the Bundle parameter explanation. android android fragments share improve this question The basic answer..

ViewPager and fragments ??what's the right way to store fragment's state?

http://stackoverflow.com/questions/7951730/viewpager-and-fragments-whats-the-right-way-to-store-fragments-state

host acitivity etc... Solution The dumb solution is to save fragments inside onSaveInstanceState of host Activity with putFragment and get 'em inside onCreate via getFragment. But I still have a string feeling that things shouldn't work like thant..... protected void onSaveInstanceState Bundle outState super.onSaveInstanceState outState getSupportFragmentManager .putFragment outState MessagesFragment.class.getName mMessagesFragment protected void onCreate Bundle savedInstanceState Logger.d Dash.. is not guaranteed to be valid because they may not even be alive. To cut a long story short your solution to use putFragment to be able to get a reference afterwards is not so crazy and not so unlike the normal way to use fragments anyway above..