4.01.2015
[Draft] getFragmentManager() vs. getSupportFragmentManager()
The ActionBar APIs were first added in Android 3.0 (API level 11) but they are also available in the Support Library for compatibility with Android 2.1 (API level 7) and above.
This guide focuses on how to use the support library's action bar, but if your app supports only Android 3.0 or higher, you should use the ActionBar APIs in the framework. Most of the APIs are the same—but reside in a different package namespace—with a few exceptions to method names or signatures that are noted in the sections below.
Caution: Be certain you import the ActionBar class (and related APIs) from the appropriate package:
If supporting API levels lower than 11:
import android.support.v7.app.ActionBar
If supporting only API level 11 and higher:
import android.app.ActionBar
in the same case:
If supporting API levels lower than 11:
use getSupportFragmentManager()
If supporting only API level 11 and higher:
use getFragmentManager()
參考:
API Guides: Action Bar
https://developer.android.com/guide/topics/ui/actionbar.html
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言