Reputation: 17753
I have came across a problem for dynamic forms in my app, which is suited for Android 2.1 and above. I know there is new Fragment API since API level 11 (Android 3.0 Honeycomb), but also I have read an article - http://android-developers.blogspot.com/2011/03/fragments-for-all.html stating Fragment Api is available also for API level lower then 11 in, so called, Compatibility package. I have installed it via SDK, but I am not able to use is in my App, e.g. I cannot import android.app.FragmentManager
, application doesn't know it.
Do you know, how to solve it? Is Fragment API truly available for older API levels? If so, how to make them going? Or is there any other solution like Fragments API? I will need for dynamic generated forms if possible
Upvotes: 20
Views: 18975
Reputation: 2126
Android Studio:
Add a dependency for support compatibility package v4:
dependencies {
...
compile 'com.android.support:support-v4:21.0.+'
...
}
and then use import android.support.v4.app.Fragment;
instead of import android.app.Fragment;
in imports.
Upvotes: 5
Reputation: 6594
Use ActionBarSherlock. It comes with a lot of working examples.
Upvotes: 0