Android 3.0 (HoneyComb) context menu question - android

When I try to show context menu in Android 3.0 instead of normal menu I see smth like in this picture - which is basically text edit/select menu.
On other devices (e.g. for SDK 5-9) it shows my context menu registered for my TextView
Anyone knows - what's going om?

I have found solution by entering in AndroidManifest.xml following snippet:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="11"/>
After that context menu in tablets is appearing as on other devices. Essential part is android:tagetSdkVersion attribute

Related

How can I get the ActionBar to render?

I'm a new to Android development and I've been giving Android Studio a spin. I've followed Google's tutorial and I still haven't been able to get the ActionBar up and running either on the emulator or on the real device. I've specified the min version in the manifest file and I've also edited the menu and activity xml files accordingly.
Confusingly, the UIs shown in the activity_foo.xml and menu_foo.xml are different:
activity_foo.xml:
menu_foo.xml:
Even more confusingly, the final app when built shows both the Search and Settings in the hamburger menu though I do not recall seeing it in the GUI previews:
How can I fix this?
Confusingly, the UIs shown in the activity_foo.xml and menu_foo.xml are different
They are supposed to be different. One is showing you a layout file. The other is showing you a menu resource. Their previews are not supposed to necessarily match. After all, an Android app that is bigger than a breadbox will have many layout resources, few of which will be defining the contents of an activity.
For those layouts that do define the contents of an activity, IIRC, you can have the same tools:context=".FooActivity" in the root element of your layout file, and the preview may take that into account.
Even more confusingly, the final app when built shows both the Search and Settings in the hamburger menu though I do not recall seeing it in the GUI previews:
In the preview, the search item is represented by a toolbar-style button (icon is a magnifying glass).
In your menu resource, you have one <item> that has android:showAsAction and one <item> that has app:showAsAction. Either you are using the appcompat-v7 action bar backport, or you are not. That would be determined by things like:
what Java class your activity inherits from (ActionBarActivity or AppCompatActivity for appcompat-v7)
what theme you are using for the activity in your manifest (if it is based on Theme.AppCompat.*, you are using appcompat-v7)
If you are using appcompat-v7, you need to change the android:showAsAction to app:showAsAction. Given the results of your run of the project in the emulator, my guess is that you are using appcompat-v7. If you make the change to the menu resource and run the project again, you may see the search item show up as the magnifying glass icon, as you see in the preview. I say "may" because there may or may not be room to show that toolbar-style icon, depending on screen size and orientation of the device that runs your app — action bar items with ifRoom will show as toolbar-style buttons if there is room or will fall into the overflow menu if not.

Remove Android options menu in XE5 Delphi

Is there a way to completely remove the Android options menu in XE5 Delphi? I've been testing my application on a HTC One and because my phone doesn't have a menu button and my application doesn't have an options button, android automatically adds a options menu. Since this button is added by Android there is no way to add items to the menu.
I've already tried to change the minimal SDK version, but this makes the application very unstable and makes it crash when the orientation is changed:
<uses-sdk android:minSdkVersion="14" />
Is there an other way to remove the options menu? Now there is just a large options menu in the bottom of my screen that has no menu items.
Ok, you're right in that this empty action overflow menu is added because of your lack of hardware menu button.
On a Nexus 7 it's not such an issue as the empty overflow menu is added at the end of the other soft buttons.
On a HTC One, however, you can configure the Home button to act as a menu button, which removes the action overflow button.
It's not correct to say you can't add items to the menu. My Android session at CodeRage 8 shows how to add menu items. However, I'll grant you, it's a bit of a faff.
In order to remove it, the docs say you should set the targetSdkVersion attribute (not minSdkVersion) in your Android manifest to 14 (see this blog post for details). However having tried this it causes a crash if you don't prevent rotation in the RTM version of XE5, as you saw with your tests. This issue is sat in QC, logged some weeks back, hopefully to receive a fix in the near future.
However you should consider restricting the rotation as one course of action...... This is easy enough.
you must change in manifest android:configChanges="orientation|keyboardHidden">
to:
android:configChanges="orientation|keyboardHidden|screenSize">
then you can set minsdk, maxsdk, targetsdk as you want, and application will not crash

calling menu from custom button in jelly bean

I would like to call my menu from a custom button :
With targetversion<=10 this works fine with calling openOptionsMenu from onClick-Method of the button:
openOptionsMenu();
From targetversion>=11 this doesn't work.
Also to mention. With <=10 the Menuitem appears at the bottom:
With >=11 this icon disappeared.
Background :
I like to have a targetversion=16.
My app hides the TitleBar and Optionmenu appears in the Titlebar in Jelly Bean.
Because of this I want to get rid of the google UI's changes every release, which costs a lot of developing/testing efforts every time. So I thought to have my own button which is GoogleApi independent.
Does anyone have any ideas or suggestions ?
regards
Are you sure you are calling openOptionsMenu() from an Activity? SDK documentation still mentions it as an active API. I double checked with <uses-sdk android:minSdkVersion="1" android:targetSdkVersion="17" /> and works just perfect.

Android - No hardware menubutton

I concluded the newer android tablets doesn't have a hardware Menubutton anymore.
So I was wondering if I have to insert an menu button in my own (fullscreen) app or does android offer a software included menubutton itself (even when my app runs fullscreen)?
(I don't have an android phone/tab myself to test, so I asked here)
Thanks,
Dennis
You should move away from menu buttons. It's the new style of Android applications. See this post from Android developer with the reasons to remove the button and what applications should do instead of offering a menu button.
Most of devices which are not having menu hardware button runs on android 3.0 or greater version
You just need to add one parameter as showAsAction.
Which will show menu item on action bar.
Concider reading ActionBar tutorial
Change the manifest file: you should change targetSdkVersion to <= 10.
Like this:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9"/>

Android menu button not show

I write an application.
It run on Android 2.3.4 phone, the menu can be pressed.
But if run on Android 4.0.3 TF201, the menu button not show.
How to let it show the menu button?
Android 4.0 will discontinue the menu button. Here is a nice article by android developers that says what to do.
If you want to give menu feature in android 4.0, you have to use Action Bar instead.Follow this link for more details
If you have to use that menu use the following lines in your Manifest file:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="9" >
</uses-sdk>
But sometimes you want a fullscreen app...for example in the Manifest is setted the activity with:
android:theme="#android:style/Theme.NoTitleBar"
The only and ugly fix is to set under the target sdk version:
http://lancelotmobile.com/blog/mobile-air-app-compatible-with-android-4/

Categories

Resources