Anyone have a working example of fragment tabs that works on Android 2.2 and support up to ICS? Every example out there don't seem to be working even after adding the compatibility packages.
There is an example using an Activity with a TabHost and Fragments inside the tabs. It uses the compatibility library and works with current and older versions of Android.
If you installed the support library and the samples with your Android SDK you will have it on your disk already:
/extras/android/compatibility/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.java
http://developer.android.com/reference/android/app/TabActivity.html
Look FragmentsTabs and FragmentTabsPager examples of ActionBarSherlock library.
Tested by me on Android 2.3 and 4.1. It works nicely and is completely reusable.
Related
I am developing an android application that must run on Android 2.3.3 onwards. Is it possible to use fragments on this application since fragments are not supported on pre honeycomb versions? If possible how?
Use fragment V4
android-support-v4.jar available in ref-lib folder
if not available add from
../android-sdks/extras/android-support-v4.jar
Extents fragment and import android.support.v4.Fragment
write to code**
hope it helps...
use support Library Actionbarsherlock or Support Library .. Support Library tutorial
I'm creating a new project and I want to use 2.3.3. I'd like to have fixed tabs + swype but the project wizard says that they are available since android 3.0
are them in the support library? can't find anything about it.
I don't want to use actionbarsherlock.
I'm trying to use android.support.v7 (adding it as external jar) but it doesn't find getActionBar() method in my activity, what should I do?
In my project I solved this with a ViewPager to handle the swipes, and by using the ViewPagerIndicator library to show the "tabs". After some tweaking with the appearance -- tutorial also found on the site --, It works perfectly on GB.
I have been using actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); in my app but the target device is android 2.3.2 and does not support this code.
Is there any solution to have actionbar and tabview in android 2.3?
The solution for getting using the ActionBar in versions prior to 3.0 is called ActionBarSherlock, and enables you to give the user a unified experience across the Android versions.
Link to the website: ActionBarSherlock.com
There's actually also something called ActionBarCompat (read more here), but it's really inferior to ActionBarSherlock.
Edit: You'll find a lot of useful samples within the project hierarchy, but this should probably be the thing you're looking to accomplish: TabNavigation.java
Use ActionbarSherlock: http://actionbarsherlock.com/
Here is the tutorial for using tabs with ActionbarSherlock : http://www.androidbegin.com/tutorial/implementing-actionbarsherlock-fragment-tabs-in-android/
Yeah ActionbarSherlock is a best way to do it.
Here is how to add it link
how to implement lateral Navigation (https://developer.android.com/training/implementing-navigation/lateral.html#horizontal-paging) in android 2.3, api version 10?
Because I did download the example provided by Google in the link but it doesn't work in device with api 10, but there are many aplications in google play that have this functionality.
Thanks in advance!
The ViewPager itself does work on Android 2.3, assuming you are using the Support Library's FragmentActivity and Fragment classes, so I'll assume the issue you are having with the example is with the tabs. In that case, I would suggest looking over the Creating Backward Compatible UIs training and specifically the Creating an Implementation with Older APIs lesson, which goes over implementing tabs in a method that works on Android 2.3 devices.
I am creating application which will support Android 2.2 to Android 4.1. The TabHost is deprecated in Android version 3.2. But the created application supported in all the versions. But I want to create the Tab bar application which will look like a tab bar in Android 4.1 while running the application in Android 4.2, If I am running the application in below android 3.2 version device, it must look like the tab bar in that device. How can I do this.?
There are many points to your question,
TabHost is not deprecated yet. Recently Google deprecated TabActivity and ActivityGroup.
Even if it deprecated, it doesn't mean it can't be used. If X is deprecated, it only means a better alternative named Y is there.
Now to answer your question, You have more than one options
You can use ActionBarSherlock as other answers suggests. (EDIT : ActionBarSherlock is now deprecated.)
You can use TabHost with fragments, See my answer here for a
good example. To use Fragment in pre 3.0 API's you need to use
Google's support library.
Try out ActionBarSherlock.
ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Tutorials:
tutorial 1 , tutorial 2 ,
tutorial 3
Just to add, Android has introduced ActionBarCompat to ensure ActionBar is compatible with OS below 3.0 down to 2.1. You can use ActionBarCompat in the support library instead of ActionBarSherlock
http://android-developers.blogspot.co.uk/2013/08/actionbarcompat-and-io-2013-app-source.html