ActionBarCompat and Using Navigation Tabs With Fragments - android

I am using the ActionBarCompat project to allow for backwards compatability with the ActionBar. Before anyone says about ActionBarSherlock I decided to use this because its provided by Google and I don't want to rely on an outside created library. However, if someone can say that any new software updates will be supported by ActionBarSherlock then I may be swayed.
I must also add that using the latest CompatibilitySupport Library is a must so if I can't do that then I can't use ActionBarSherlock
My Problem
I have implemented my action bar using the ActionBarCompat library and it works on all API's.
I now need to add Tabbed navigation to allow the switching between Fragments
My Question
Is this easy to implement or do I have to add handling for this myself?
Thanks in advance

After more hunting around for an answer, I found out that its not supported in the ActionBarCompat.
I'm going to look into ActionBarSherlock. The only thing holding me back is whether or not I can incorporate the SupportMapFragment in it.

Related

Doing an Android sliding drawer without the support APIs

I'd like to add a sliding drawer to my app which is using the min sdk version of 16 and a target sdk of 21 and should allow it to use the most recent features of the platform.
I looked around on how to implement a sliding drawer, and all the articles I found talk about using some support APIs to do just that.
My app is not yet using these support APIs.
I wonder if implementing the sliding drawer is possible without any support APIs, and if so, if there is any resources showing just that.
DrawerLayout, the basis for Creating a Navigation Drawer is only found in the Android Support Library (along with many other Support Library only APIs). There is nothing in the Android framework that provides this same functionality.
To provide the most consistent experience to users, you should just use the Support Library.
You should consider using support APIs, but if you really dont want to, you can use user-created library.
Here's one I used for one of my projects:
https://github.com/mikepenz/MaterialDrawer
Yes, it is always possible. However, the DrawerLayout class is available only in support libraries.
When I first realized that, it made no sense to me. But now I see support libraries as an extension of the core libraries (android.*).
Anyway, I recommend using the support libraries or you will have to create the logic to do exactly the same from scratch.
You can use android design support library, it's working on all devices in android and it's open source so you can edit it as you like with custom element.
Here's a reference how to implement Navigation drawer using new android support library

Design of ActionBar

I have question about graphic design of android application. On this link you can see my ActionBar in my application using SherlockActionBar. But I want something like on this link. Where can I learn how to do something like that or where can I edit my ActionBar.
I would recommend against using SherlockActionBar for this. I've tried and it just seems so messy and difficult to implement.
In May 2013, Google released a new support library for this kind of Drawer Layout which uses fragments. It's very easy to implement and there are many examples showing how.
Edit:
i see now that on the link you provided, they were using the support library I referred to. However, I do suggest you take a look at the support library, specifivally v7, which will allow you to use the Action Bar in previous version of android, rather than relying on a 3rd-party software package like ABS.

Android: Setup App with ActionBar, Tabs, Fragments, Swipe compatible with SDK 8 (Android 2.2)

I'm planning an Android app that should make use of lots of UI features that later SDK versions bring with them incl. ActionBar, ActionBar.Tabs, Swipe navigation and use of Fragments (with replace, add, FragmentTransaction etc). The app should support SDK 8 (2.2) and later.
I'm a 'bit' at a loss here on how to set this up: will I be able to use all these features with the official Android compatibility library? Or will I have to use ActionBarSherlock? Will ABS give me advantages/ be easier to implement compared to the official comp. library?
Can I use the Eclipse/ ADT navigation templates with those two librarys? Can I use them alongside each other or do I have to comit to one of them?
Lot's of questions, I know :)
will I be able to use all these features with the official Android compatibility library?
No.
Or will I have to use ActionBarSherlock?
Yes.
Will ABS give me advantages/ be easier to implement compared to the official comp. library?
It will give you a backwards-compatible action bar. The Android Support Library does not.
Can I use the Eclipse/ ADT navigation templates with those two librarys?
You can do whatever you want. You will need to replace some stuff generated by those templates.
I think using using ActionBarSherlock is the best.
Have a look at this link

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/

Fragment with compatibility pack and > honeycomb

I have to write an app for both phones and tablets and I would like to use the same project for both. It seems the use of compatibility library is good to write reusable code.
Is possible to share the same Fragment class for both?
I'm thinking about a starting activity that "forks" the app in pre-honeycomb activities and post-honeycomb, reusing the same Fragment classes. The fact is if I include android.app.Fragment, the fragment will not be usable from a FragmentActivity and viceversa.
I could use only FragmentActivities, but this would prevent the use of the actionbar.
How to do this?
The solution in the example here does not seem to be appropriate.
For contacts the problem is that there is a class that is deprecated but you can still compile it.
With fragment if you refer to android.app.Fragment you can't compile that class with the sdk < 3.0 while if use import android.support.v4.app.Fragment you can't compile for honeycomb (you can only if you keep using the support lib even on honeycomb that does not seem to be the best thing to do).
I managed to do it only by having two different projects that expose two different implementations of a proxy. Than I use the right implementation for each sdk. It is not as simple as it looks because you will have to make a proxy for FragmentTransaction, FragmentManager etc.
It worked for me but it did not work for settings with fragment. In that case the xml files that use fragment can't be compiled with pre honeycomb sdk.
Yes you can share the same Fragment class for both. You don't want to be touching actionbar code on the phone (pre-honeycomb) so an easy way is to simply hide your actionbar code in an adapter class that you only make use of in your Fragment for honeycomb+, see answer here.
One thing that you can then do is make use of version/size specific resoures such as menu, menu-v11 etc to add say menu items to either your action bar on a tablet or the standard menu pop-up on a phone.
You could use ActionBarSherlock which is a compatibility library that integrates and builds on Google's own compatibility library but provides backwards-compatibility for the Action Bar as well as fragments and all that other good stuff.
It uses the native ActionBar classes provided by API 13+ so the code should be re-usable for your "forks" (or you may not have to fork as much/at all).
Worth having a browse of the website...

Categories

Resources