Android Menu Overflow - java

My Problem is that in some cases the overflow menu dosent work on some phones. First i thought it is the android version and designed 2 different menu xml.
But a Samsung Mini S4 with 4.2.2 doesnt show the overflow and Samsung S5 with 4.2.2 shows the overflow menu.
It seem maybe something to be with the hardware buttons, i dont figure it out.
Can anyone help me how to detect when the menu overflow is shown?
I use following: Com.android.support:appcompat-v7:21.0.3
Thanks Malte

Yes, it is the hardware menu button. So on devices that have the hardware menu button, the overflow menu will not display since the user can use the hardware button (it reduces redundancy). However, IMO it also reduces usability since most users do not think to hit that button (at the least, they do not in my apps).
So you can detect the hardware button: Android: Programmatically detect if device has hardware menu button
And then display a menu item that looks like the "***" menu button and have it activate the menu if you like.

Related

How to add Android Device Monitor to Main Toolbar in Android Studio?

I'm following Udacity's Developing Android Apps class, and in their video it shows an icon at the top of Android Studio for a shortcut to Android Device Monitor. My shortcut icon is not there so I had to search to find it.
I'm trying to add it to the toolbar by right clicking and going into "Customize Toolbars and Menus" but I can't find anything. I googled multiple different things and can't seem to find the answer. Not sure if this is a recent change from Android Studio updates.
Is there a way to add this to the top toolbar? Thanks!
fortunately it is :)
open the customize menu and toolbars by right clicking the toolbar.
Navigate to Main toolbar-Android.MainToolBarSdkGroup and then click Add after... (in fact you can choose whatever position you like most).
Then simply choose All actions-Main menu-Tools-Android-Android device monitor
Profit – robot is there :)

Hardware and Software Search button in Android

I've implemented search functionality as explained in http://developer.android.com/guide/topics/search/search-dialog.html. This works fine on Android 2.3.5 with the hardware search button. Now I wonder how I could integrate a software search button. I added a button in the ActionBar but now I wonder how you can show a dialog for inputting the query as with the dialog showing up after pressing the hardware button.
In your onOptionsItemSelected method, check if the user pressed your search button.
If so, call the method onSearchRequested() in your Activity, and your custom search implementation should pop up.

Android Action Bar Title Text not clickable on certain phones

I have a project that I am currently updating. In previous versions I have been able to select the title text, and it would react as part of the back button in the action bar. I currently have no icon in the actionbar by design and in previous versions the text was still interactive.
I tried implementing different layouts for varying screen sizes, however, since then on normal and small screen sized phones (tested: Samsung Galaxy S III Mini and Sony Xperia tipo) now only the back button ("<") reacts to touch.
The title text is still clickable on an Samsung Galaxy S4 and a Nexus 4. I have reverted the code back to how it was before I made those changes, along with trying code from last week to make sure nothing has changed, and the bug still occurs. I have tried other apps on the Samsung Galaxy S III Mini and the text in RedReader is clickable, so it's definitely app side, but I am not sure what has changed that will cause this.
I am currently at a loss as to why it is doing it. I've also attempted to update ActionBarSherlock to see if that may have caused an issue, but I am not sure what to try next.
Title on ActionBar is clickable from 4.2.2 version of Android. Before only < or icon.
If you have the need to implement this functionality in previous versions (including versions 2.x), you can use the ActionBarSherlock.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Visit http://actionbarsherlock.com/

Nexus Navigation Bar Overflow Button

I am currently improving an android application of mine and was wondering how I would be able to enable the overflow button on the nexus virtual navigation bar. Does anyone know how I would accomplish that?
The three dots menu appears if your application does not have an ActionBar but declares a menu.
This kind of menu is made to support applications that do not use ActionBar menu on devices that have no hardware menu buttons.

buttons ontop of everything in android

I am currently working on a calculator application for android. I am finding it difficult to conveniently take a screen shot of the app. So i have put my calculator on pause so I can write a simple screen shot app. It runs in the notification bar and when you click the notification the notification bar slides away and a few seconds later a snapshot is taken. This works perfectly. Now I would like to add functionality to take snapshots even for full screen apps. I have seen apps that put a sliding drawer on the screen onto of whatever app is running. That is there is always a button on the screen no matter what you are doing that when you click/drag it that sliding drawer came out. How did they do that? It should be a simple process to use a button instead of a drawer and when it's clicked hide it, snapshot and unhide it.
So my question bsically is
How can i put a usable button on the screen that stays above whatever app is running, even the homescreen
I realize I'm not answering your question directly, but if you simply want to get a screen capture of your application running, I would use ddms in your android tools directory. It has a menu option for getting a screen grab. I use it frequently.
Just go to Device > Screen Capture
More details here :
http://developer.android.com/guide/developing/debugging/ddms.html

Categories