Basically I would like to know if we can have fragment layouts in devices with Android OS < 3.0.
My app had a header on top with 5 different buttons and on start always the first button is clicked by default so the view below these buttons is for the first view. Now when you click on the second button beside it, I don't want the header images to be refreshed but the view just below it needs to be refreshed. So its like updating the fragments below the header image buttons.
So can we have fragments in Android in devices with OS < 3.0.
Sana.
A fragment can implement a behaviour that has no user interface component. Fragments were added to the Android API in Honeycomb version of Android which API version 11.
Using the support library, fragments are supported back to all relevant Android versions. Fragments encapsulate views and logic so that it is easier to reuse within activities.
In Activity 1, there are two fragments, Fragment A and Fragment B. When we select an item from Fragment A, it gets open in Fragment B of the same activity. In the case of mobiles, there are two activities that are: Activity 1 with Fragment A and Activity 2 with Fragment B.
You have to use the compatibility libraries provided by Google. Here's how you use Fragments on devices < 3.0
Once installed, right click the Android project you want to add Fragment support for.
Now you application supports Fragments. There are some key differences to using the compatibility package over using SDK 3.0+. For instance
FragmentActivity
NOT Activity
. getFragmentManager()
you have to use getSupportFragmentManager
Enjoy!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With