aspose file tools*
The moose likes Android and the fly likes Not everyone is using Jellybean yet, thus ActionBarSherlock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Not everyone is using Jellybean yet, thus ActionBarSherlock" Watch "Not everyone is using Jellybean yet, thus ActionBarSherlock" New topic
Author

Not everyone is using Jellybean yet, thus ActionBarSherlock

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I have been told to use ActionBarSherlock for every app that I work on.
However I find that ABS increases the size of my apk.
What other options can I utilize to support Android 2.2+ up to the latest Jellybean OS ?


Regards,

Pho
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

I have a custom view I add to the layout when I am below HONEYCOMB. This view has the app icon, the app name, the same colors as the ActionBar, You can check your run-time version and have methods which are target above of below honeycomb. For example:



I have two layouts I use: one has a back arrow that you can use for 'up navigation' like you get on the Action Bar, the other does not. I generally do not put menu items on the custom title bar (although I think you could) because I think folks who have the older software expect the menu to be in the area provided by the menu button.


Steve
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

That solution is obviously very basic. You can use it to provide a consistent L&F, but you don't get all the functionality of the ActionBar - tabs, spinner selector, etc... If you want them you could roll your own but then - that is why ActionBarSherlock was created - so you don't have to.
D. Smith
Author
Greenhorn

Joined: Jan 11, 2013
Posts: 25
    
    5

However I find that ABS increases the size of my apk.


This statement is true of any library that you add to your code, and is the tradeoff for doing so. One of the reasons ABS in particular is larger than some is because it needs to bundle up all the resources necessary to display the ActionBar using the Holo style themes that don't exist prior to Android 3.0.

Creating a common view in your layout that "behaves" like an ActionBar is pretty straightforward, as Steve has already mentioned, it just requires the extra work to implement any of the other custom features (i.e. menu support) the framework provides. It also means that in the future when you want to support Android 3.0 and above, the work you have to go through to move to the native ActionBar will be more significant.

I have heard straight from the mouths of many Google engineers on the Android team over the past year that ABS is the best stop-gap available until older device support can be dropped. They have proposed a solution in the form of an AppCompat library that should be added to the current support library in a future release, but many of us are beginning to doubt that it will ever be released, or at least before Android 4.0 becomes dominant and the issue is no longer relevant.


Android Recipes: A Problem Solution Approach: http://www.apress.com/9781430246145
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Thanks Steve for your solution.
Although all the if statements might just push me to only target the new API levels & forget about the older devices.

@D. Smith, Thanks for your reply. Yes, I do hope that the ABS will slowly fade away.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not everyone is using Jellybean yet, thus ActionBarSherlock