Use SupportFragments and FragmentActivities everywhere.

Issue #42 new
Raymond Wells created an issue

"SupportFragments", aka android.support.v4.app.Fragment have a number of advantages over regular android.app.Fragment objects:

  • They support nesting.

  • They have the most recent bugfixes. (I've run in to a few bugs with android.app.Fragment). fragments not being destroyed/overlaying other fragments.. nasty.

  • Fully backward compatible with devices even before 3.0.

  • Compatible with the FragmentTabHost view.

  • It is possible to access the containing fragment with getParentFragment().

What needs to change?

Very little:

  • No external libraries (already included in the android support libs).

  • Change any imports of android.app.Fragment to android.support.v4.app.Fragment

  • ^^ Same as above with FragmentManager & FragmentTransaction.

  • Change all activities to a FragmentActivity.

  • Use getSupportFragmentManager() instead of getFragmentManager()

  • Change instances of getFragmentManager() used for fragments within fragments to getChildFragmentManager()

This has been done for almost all of my additions, as the "support fragments" are more stable.

Comments (2)

  1. Log in to comment