this is my sittuation ...
A customer gave me an application done partially by somebody else. That person used fragments to build the UI.
The guy who gave me the application to finish the development of it, just realized that he wanted that the application run on android devices with 2.X
So, I am wondering if it is possible to have two UI's : One for Android devices that support fragments, and another one for android devices which do not support fragments.
In case that is possible, can that be deffined on the xml as alternate resources is done ? Or that needs to be programatically? (I mean check android os version and alternate UI's)
Thanks!
Lucky for you, the Support Library has Fragments in it, and supports back to Android 1.6. So you can use the "support" class for Fragments and it will work on old and new devices alike.
http://developer.android.com/tools/extras/support-library.html
http://developer.android.com/training/basics/fragments/support-lib.html
Related
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 ...
I'm planning on writing an app and building against 2.2 Froyo (API Level 8). However, I want app users of 4.0 ICS to experience the app with the ICS user interface.
Currently my approach is to have the default activity of my app sense the version of the Android device.
If it is less than 4.0, use XML views written for Gingerbread and Froyo and, if it's 4.0 or higher to use ICS XML views. This however seems a bit haphazard and I'm not sure I can manage the separation of version views effectively.
What approaches, tools, and ideas can I use to help me make my app? Is it even something I need to consider? Is my idea of the view separation above correct? Do I have alternatives I could use instead?
Cheers!
If you just want to apply different resources for different OS version, you can let system do it for you by putting your resources into different resource folders with the "v" qualifer. Such as "layout-v8" folder for layouts used for Froyo and "layout-v14" for layouts used for ICS. I did not try this but from the document, that's what it supposes to do.
The Crunchyroll app (an anime viewer) has separate activities and layouts for Froyo vs. Honeycomb/Google TV, defaults to one or the other on initial startup, and thereafter allows the user to declare a preference for one or the other. I'm not affiliated with CR, but I use and have studied the app. One problem the app has, which may be encouraged by the level of separation it has between the two targets, is that the pre-Honeycomb interface has many features, and continues to receive updates, that the tablet/TV interface is only promised.
As for tools, you can use later features while targeting an earlier OS with the SDK's support package, which backports features (e.g., fragments) appropriately.
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/
I am starting my programming with fragments. i want to do it for android 2.2 first then for android 3.0/3.1/3.2.
I added Compatibility package , all things i did.
What i want just give me some sample example for android 2.2 fragments for better understanding that how to use fragments in application.
there are the Api4+ and the API 13+ demos. You can download an install on your phone and try it and choose which one is the best for you. The source code is very helpful and commented.
For My Android Application I need to design multi-panel User Interface, Like with android sdk
3.o newest version they provide a new Concept of FRAGMENT but our Android Board is running with sdk 2.3 version, I am Continuously searching to get this fragment thing by any other way , we need to design same fragment like design for Activity with sdk 2.3 API level-8,
I didnt get any way to do this,Like I am using TAB layout but it is from my side ,not much more comfortable.
Please give me some solution to get it
Depending on how soon you need this done, you might want to wait for the fragment SDK to be released by Google. They've said that fragments are fairly easy to package up for inclusion in older versions of Android. They said "soon". Unfortunately, there's really no way to know when "soon" is.