Is it ok to use TabActivity still for my app? - android

My app is in need of some tabs and the TabActivity works great for it. It's much easier than wrapping my head around those Fragments... but I see that Android says to do Tabs in FragmentActivity now... My question is If I'm targetting 2.2 phones is it ok for me to use the TabActivity instead? Will I run into any issues in the future by making the app this way?

Its recommended to use Fragments, i know it has an initial learning of few hours but its worth the effort. Use compatibility library for using fragments in Android versions lower than 11.

Related

Tabs layout and Android sdk

Until now I was using TabActivity for Tabs layout.
Since this Activity is deprecated What will be the best way to form a tabs interface?
I saw many tutorials showing the use of TabFragments but this is good only for high sdk version (15 and higher).
So what objects can I use for tabs layout considering it should work with API 10 and above and of course not deprecated?
An example will be great!
As Commonsware said here ::
"Deprecated" in Android means "we think there is a better solution that you should investigate". Rarely does "deprecated" mean "it is unusable". TabHost, AFAIK, works fine on Android 4.0.
There are also project named ActionBarSherlock which demos have all the capability of the compatibility library. Source code is also available on github.
There is also this tutorial which helps you how to use TabFragement.
I faced the same question while ago too and the best solution is use ActionBarSherlock with Fragments and there is a really nice tutorial how to implement TabHost in your app which you can find here :
ActionBarSherlock:FragmentTabs.
It worked for me, hope it will work for you too : )
P.S. And one another thing, it is really good when you are building an application to look for design guidelines and the best ways you can build your app so you can take advantage of the latest news in Android App Development.

How to support tabs on Android 2.2+?

I'm trying to offer tab support for all Android versions 2.2 and above. Is there a way of achieving this without using any deprecated classes/methods?
The Problem is as following:
TabActivity is deprecated because it derives from ActivityGroup which is deprecated, too. Problems are, to start Activitys inside Tabs and don't break callbacks like onActivityResume. There are some 'Hacks' around which solve this but they are ALL relying on the deprecated LocalActivityManager. So I see no solution of using Tabs without ANY deprecated calls. Since Android 3.X google invented Fragments for this kind of things which are supported on lower Versions with the SupportPackage. You should definetly try them in Combination with the new ActionBar if you want to avoid deprecated classes/methods
EDIT:
Link to FragmentTabs for further reference
I recon with with the answer Rafael gave.
Instead of resorting to the TabActivity you can sill use the regular TabHost to show tabs in all versions of android.

Is it smart to publish tab-activity-based app to Android 4.0+ devices?

I have a TabActivity-based project which I want to publish to Android 4.0+ devices as well. When I load it with SDK 4.0+ library, I receive a warning "android.app.TabActivity" is deprecated.
We all know that this is due to the fact that fragments are advised for any 3.0+ app, thus making TabActivity deprecated.
Now, is it smart simply to include Android 4.0+ devices to use this app? What are the hidden bombs/bugs?
I am asking this as moving to fragments would require a complete app redesign and 2 months of work.
yes, i personally too have used TabActivity where it suited perfectly for the requirement in one of the cases... Fragments adds on the concept and provides more advanced and diff features, but yeah it works very differently from TabActivity.
Android recommends Fragments to more of support high variation in screen sizes , but switching from TabActivity to Fragments just to replicate same feature won't be good idea ...

Cross Version Compatible Android Tabbed Layout

I'm looking to create a cross-version compatible android tabbed layout.
The problem I'm running into is when implementing Google's example of TabActivity, I get a depreciation notice. The app I'm writing needs to be compatible down to 2.1, and I'm not finding a clear cut way to make it compatible.
I am aware of the versioning by folder (/layout-v4, /layout-v14, etc) but if possible I want to avoid this.
Are fragments the answer here and if so, does the Android Compatibility Layer V4 become the key to solving this problem?
I'd suggest the best approach might be to use the excellent (and free) ActionBarSherlock, so you can add Android 3+ action bar (including tabs) to apps going all the way back to v2.x versions.
I've used it on a few apps and it's pretty easy. I think it's the right approach to use the proper Action Bar interface across platform versions, and they include tabs and replace the whole TabActivity thing, which was pretty horrible anyway.
http://actionbarsherlock.com/

Should a newbie forget about fragments?

I just started developing on Android. I'm practicing with a Tablayout tutorial in API 15 when I see TabActivities are deprecated.
Would I be better off just forgetting about Fragments for now and keep developing with TabActivities?
Would I be better off just forgetting about Fragments for now and keep developing with TabActivities?
IMHO, no.
Get yourself a copy of ActionBarSherlock and implement tabs in the action bar. That is the tab pattern going forward with Honeycomb and Ice Cream Sandwich, and ActionBarSherlock lets you use the same approach for Android 2.x devices as well. You are better served aiming for the future, not the past.
Note that you do not have to use fragments with action bar tabs, though you can.
I suggest you learn Fragments. There's no point in using TabActivities any more, there's a static support libary (you can see it available for download in Android SDK Manager) that will allow you to use fragments on older APIs - that's the way it's meant to be done now.
Go with Fragments and action bar pattern, new is always better :)
Also, be ready to dump any other deprecated piece of API or obsolete UI approach. Mobile development evolves pretty quickly.
No, just follow the example here for how to Tabs with Fragments: http://developer.android.com/reference/android/app/TabActivity.html
Normally, I would say that using a deprecated API is a bad idea. However, since you are just practicing and presumably do not need to release this application on a wide range of devices, then just carry on with the tutorial and happy learning.
Hope that helps and enjoy Android.

Categories

Resources