Workaround for menu button for newer devices - android

I am new to Android app development and I recently published my first app. My app uses the menu key to display 2-3 functionalities. But there are HTC Evo 4G users who sent me e-mails complaining that they cant use that because their device doesnt have a physical menu key. Now how do I implement a solution the best possible way? The app supports devices android 2.2+ How do I add a action bar without breaking my app? I was wondering if I should add a action bar for all android versions or only for 4.0 and above? What would be easier?

My app uses the menu key to display 2-3 functionalities.
It should be doing so by using the standard options menu system.
Now how do I implement a solution the best possible way?
Add android:targetSdkVersion="11" (or higher) to your <uses-sdk> element in your manifest. Your title bar will be automatically converted to an action bar on API Level 11+ devices, and your options menu will appear as the overflow menu in the action bar.
How do I add a action bar without breaking my app?
See above.
I was wondering if I should add a action bar for all android versions
You can certainly do this, using libraries like ActionBarSherlock.

Related

Hide specific button on android navigation bar

I have another question for you:
Is there a way to hide a specific virtual button from android navigation bar?
My particular case is hide recent apps button. I've searched in some posts about this, but they mention how to hide or disable navigation bar. I just need to hide one virtual button from navigation bar.
I hope that you can give me an answer, thanks!
Update:
Somebody told me that Airwatch app from VM-Ware does this customization
It is currently impossible to make an App-specific customization, but it is possible to make a device-specific modification on Navigation Bar, starting from Android 8.0 (Oreo) by unlocking System UI Tuner.
However, do consider the limitation as both Navigation Bar and System UI Tuner ability is pre-defined by OEMs. Which means we cannot customize more than the given customization choices, and different device might introduce different customization capabilities.
You can not change the navigation bar from your application; you do not have access to these settings. Instead, what you can do is using adb to hide the navigation bar and use only the navigation inside your app. You can follow this tutorial of XDA-dev and their application called "Navigation Gesture", you will find the adb command.

How to migrate app from sdk 8 to newer versions?

I've been developing an app (min sdk 8) that uses the physical menu buton for almost everything into the app. Recently I've bought a new cellphone and I realize that it doesn't have a physical menu button, compromising the usage of my app. I don't want to change the min sdk version, what is the best way to migrate to newer versions? I've taken a look into Action Bar but I don't know if I need to reimplement everything I've made so far (removing the logic that uses physical menu button) or if I let how it is and just implement new logic that uses action bar.
Thanks in advance.
You might want to take a look at ActionBarActivity from the support library. They have similar callback like onCreateOptionMenu, onOptionMenuSelected etc. So it is not that hard to make the transition in terms of the menu button you talked about.
Don't worry about action bar, you can use v4 or v7 support jars which will work on lower versions as well.
Hard menu button is just to give options menu. If you use action bar you will see three dots on the right side which indicates options menu.

Android: How can I add a menu softkey to the standard softkey bar?

I'm developing an app and I'm having problems to make my menu accessible on devices with no menu hardkey.
I have found that the recommended solution for this is to use an ActionBbar. But I have started to develop this app quite a while ago and changing my TabActivity to an ActionBar results in an apparently endless chain of other problems.
I have found an app that adds a forth softkey as a menu softkey and my question is how can I achive this?
Here is what the softkey bar looks normaly:
https://docs.google.com/file/d/0B_dSVLmzXlwiaUhSelFVOXBvQWs/edit
Here is what I want to achive:
https://docs.google.com/file/d/0B_dSVLmzXlwiajdacW56cFdOb0E/edit
(Can't upload pictures yet because of my new membership)
That functionality is only available to remain backwards compatible and you really should try to implement this in an ActionBar. However, if you dont use the ActionBar and minSdkVersion is set to 10 or lower AND targetSdkVersion is under 14, you should get that extra button. From the android developers blog: http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html

What/Where is the android ActionBar?

I've never really handled an android device before. I've read most of the discussion on here :
http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems
From what I gather if I'm using a Holo theme and that my target is at least API level 11 I should have an action bar within my app.
How exactly do I open it up with the keyboard? My emulator has a custom size(8" tablet) and I don't know how to see the action bar :
As you see on the screen I have no idea where this bar is supposed to be at.
Its that bar at the top with the app title in it!
As most of us android developer - I assume - still want to support Froyo, many of us use
actionbarsherlock.com
which brings Action Bar down to API 2.x
- from my experience with it so far it is an awesome lib.
Just a hint for the case you start liking the Action Bar ...

Proper user experience for ActionBar on phones with Menu buttons?

I have an app that's built for Android 2.2, so I'm not using the 3.0+ built-in ActionBar class but rather building my own custom ActionBar implementation using Google's older UI recommendation that was introduced a couple of years ago.
All of my screens have between 1 and 3 actions that can be performed, so they all fit very nicely into the ActionBar UI (which Google recommends has a maximum of three buttons). The problem now is that none of my screens have a regular options menu and so they do nothing when the user presses the hardware Menu button.
According to Google's interface guidelines, this is correct behavior. If your activity doesn't have an options menu then it should do nothing when the Menu button is pressed. I've found during user testing, however, that users are quite perplexed when they press Menu and nothing happens (and every single user has tried, usually multiple times). They say that they appreciate the actions being exposed on the screen through the ActionBar, but at the same time they want the Menu button to do something.
I've been looking at Google's first party apps and it looks like they just always have enough options available to be able to load up the options menu with stuff after the ActionBar is full. Google+ seems to use the Menu button in the traditional way for overflow options on phones that have one, and they show a dropdown menu in the ActionBar for phones that don't. That would work if I had more than three actions but I currently don't.
It seems that the only way to meet my user's expectations is to put some junk options that have no value into the Options Menu just so that something happens when they push the button. I really don't want to do that. Does anybody know of a good way to deal with this problem? Should I just leave the menu button alone and expect people to figure out that it doesn't do anything?
I think it's safe to assume that most users don't know the menu button exists and having all of the actionable items displayed on screen is best. User testing by Google has revealed this and it is why they have chosen to eliminate the menu and go with the built-in action bar starting with Android 3.0 and culminating in the recent 4.0 release.
Something to think about would be added a single "About" item to the pre-3.0 options menu/post-3.0 overflow menu. This could just popup a dialog with simple info about the application (e.g., version, licensing, link to website, author, etc.). This way there is something there should they happen to press the menu button but it is not required in order to properly use each activity to its fullest potential.
I have an app that's built for Android 2.2, so I'm not using the 3.0+ built-in ActionBar class but rather building my own custom ActionBar implementation using Google's older UI recommendation that was introduced a couple of years ago.
As an author of an action bar library this sentence disturbs me. It's fairly trivial to use a custom action bar implementation on pre-3.0 and the native one post-3.0. Take a look at Google's Action Bar Compat sample.
...or, you know, you could also go with a library like ActionBarSherlock that does this for you! </shamelessPlug>

Categories

Resources