- edited description
Use SupportFragments and FragmentActivities everywhere.
"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
toandroid.support.v4.app.Fragment
-
^^ Same as above with FragmentManager & FragmentTransaction.
-
Change all activities to a
FragmentActivity
. -
Use
getSupportFragmentManager()
instead ofgetFragmentManager()
-
Change instances of
getFragmentManager()
used for fragments within fragments togetChildFragmentManager()
This has been done for almost all of my additions, as the "support fragments" are more stable.
Comments (2)
-
reporter -
reporter - edited description
- Log in to comment