Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

actionbarsherlock - getSupportFragmentManager() versus getFragmentManager() in android 3.0+

In the documentation for android.support.v4.app.FragmentManager:

"Static library support version of the framework's FragmentManager. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview."

So, do I need to do a check at runtime and use the appropriate FragmentManager for the android version the app is running on? i.e. call getFragmentManager() if on android 3.0+ instead of getSupportFragmentManager()

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There's nothing wrong with using getSupportFragmentManager() on Android 3.0+ as long as you have the support library imported. If you want to use getFragmentManager() for SDKs 11+, go for it; just keep in mind that you may be if/elseing a lot of code with version checks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...