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.
Related
I want to implement the android navigation drawer for my app that is supporting jellybean and higher. All tutorials I seen so far use the support version.
I am wondering, are they doing that to support people who want to support old android versions?
If possible I want to use the non-support version. Does anyone know where I can find a good tutorial for that?
Or is using the support version the only way to get it?
http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
Thanks
The docs for the Support Library states:
The Android Support Library package is a set of code libraries that
provide backward-compatible versions of Android framework APIs as well
as features that are only available through the library APIs.
This means that this library contains components, which are not included in the Android SDK. F.e. the ViewPager and related classes like the family of PagerAdapters or even the DrawerLayout.
Android Navigational Drawer is supported on minimum which version? Also can we make Custom Navigational Drawer in android? If we can then kindly tell me how to get started. I have read the documentation from Android Developer Site but many things I can't understand and want help
Thanks in Advance.
The Navigational Drawer is part of the suport library v4.
From the Android doc:
Support android.app classes to assist with development of applications for android API level 4 or later.
So you can use the navigation lib from api 4 onwards.
Its available from API 2. I believe. So almost all device. I recollect seeing it in Google IO videos.
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
What is the best and most standards compliant way to put a map inside a tabbed Android application?
I have intentionally been vague with the programmatic setup of the aforementioned application because I have been wading through compatibility packages and APIs and all manner of sugary Android versions looking for a the most universally compatible method. It seems as though Google wants developers using Fragments as tabs, rather than using the TabActivity setup. Thus, I am forced to use the new Google Maps V2 API because of my necessity for the MapFragment Object. After placing a SupportMapFragment in a FragmentTabHost in a FragmentActivity I am left without a clue as to how to make the MapFragment display something.
I am basically suffering from severe lack of a clue. Doing searching on my own has not been particularly successful because I am wary of using the older versioned Android solutions; I would rather use the Support package, as it seems to ensure that my application will support the old AND new Android versions.
I like sample code.
I ended up converting to and using Fragments with FragmentTabHost in the google support library. The new google maps Android API v2 came out earlier in the month supporting MapFragments, and thus my problem was solved.
I'm not sure if it's the best way, but I got it working after some trys in this post:
NullPointer or InflateException when searching on Google Maps
See if it helps giving you an idea how to implement it on your app. I use an actionbar for the tab navigation BTW.
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.