android 4.0 - How to get bottom menu button using theme black? - android

I am trying to create an android app that has the following:
Theme set to #android:style/Theme.Black
Bottom options menu button on all activities except for one.
I am trying to remove the bottom menu button from the activity that I do not want it to appear on by returning false in the OnCreateOptionsMenu method. This doesn't work...
So if I compile my app to target sdk version 14 the menu is gone from every activity...
How can I achieve this?

Assuming you are thinking of the standard Android MENU button, this cannot be removed. Keep in mind that on many older phones, this is a hardware (physical) button.
I recommend reading the advice I received in the following link, regarding the MENU button and the various issues pertaining to the changes from earlier version of Android to ICS.
Handling the missing MENU button in new versions of Android (3.x and up)
Also, I would pay attention to the following official info from Google, and strongly considering rebuilding the app to not be dependent on the MENU button.
http://android-developers.blogspot.no/2012/01/say-goodbye-to-menu-button.html
Not only should your apps stop relying on the hardware Menu button, but you should stop thinking about your activities using a “menu button” at all.

Related

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.

Do all android versions Api-8 and above have back button

Is it correct that back button is available in all android phones/tablets API-8 and above ? Since if it is not a standard feature I would like to put ActionBarsherlock in my app for navigation
My app totally relies on the existence of a back button is it correct approach or should the action bar must be provided on certain versions ?
Thank you
yes it is available on all API-8 + android phones, to keep consistancy though, the home icon in the action bar should be used as a back button as well :
from http://developer.android.com/guide/topics/ui/actionbar.html#Home
Note: Up navigation is distinct from the back navigation provided by the system Back button. The Back button is used to navigate in reverse chronological order through the history of screens the user has recently worked with. It is generally based on the temporal relationships between screens, rather than the app's hierarchy structure (which is the basis for up navigation).

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

Android popup with checkboxes

In my app I would like to have something quite similar to Android's built in popup menu (see link below), but it also needs to include checkboxes and images and I should be able to choose several checkboxes before closing (with the same button that opened it). Is it possible to do that with android popup menu? Is there a better way? Any chance there is a way to do it on android 2.1 (this the version on my demonstration device)?
Thanks for your time,
Lior
You can use the overflow menu in Android 3+. But there is a way to use it in lower APIs by just using ActionBar Sherlock. See the demo App of the ABS. There is also a demonstation of it.
It should look something like this.

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