manojmore
manojmore

Reputation: 410

Android- Fragment in API 8

I am working on Android API 8. I have to use fragments, which are not available in API 8. Is there any workaround to use fragments in API 8?

Upvotes: 2

Views: 3542

Answers (2)

Chirag
Chirag

Reputation: 56925

I think that, in order to include fragment in Android 2.2, you need to add android-support-v4.jar to your project.

OverView and Revisions of the Android Support Library

Download: use your SDK Manager. Here's how to do it step by step.

Upvotes: 5

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

Fragments are Android feature since Honeycomb and is not available natively on older versions. Yet, as fragments are THE way to go with android UI, Google released so called "support-library". which is just fragment manager and stuff in form of jar, you can link to your app. Support library runs even on Android 1.6 and is mostly the same HC devs can use (with exception of some preference fragments). You code almost the same way, except you have to link with said jar and differently obtain FragmentManager. Please note that it is safe to use this library on Honeycomb or ICS or JB. There will be no conflict and your app will run as expected too. You should not use this library if you target HC and up and do not plan to support older versions of Android, but it is mainly because you'd link to library you do not need. Read this Android SDK article on support library

Upvotes: 1

Related Questions