1

In my android application I declared

android:theme="@android:style/Theme.NoTitleBar"

but I created the onCreateOptionsMenu in my Activity but it is working fine in Samsung mobiles because in Samsung mobiles have a hardware Setting button

but in nexus and etc mobiles we don't have the hardware Setting button, pls tell how can we create the hardware Setting button like (Three dots settings)

see the image how to do that

enter image description here

Lucifer
  • 29,392
  • 25
  • 90
  • 143
Anupama
  • 373
  • 2
  • 3
  • 17
  • possible duplicate of [Android Action Bar Three Dots not displayed](http://stackoverflow.com/questions/19741319/android-action-bar-three-dots-not-displayed) – Szymon Mar 25 '14 at 09:36
  • You can check it http://stackoverflow.com/questions/10601552/android-custom-overflow-menu-without-actionbar-and-no-menubutton?rq=1 – kalyan pvs Mar 25 '14 at 09:36
  • http://developer.android.com/guide/topics/ui/menus.html – user370305 Mar 25 '14 at 09:37

3 Answers3

0

To get the menu button like in the screenshot you have posted, you will need to change your targetSdkVersion in your manifest file to something less than 11. Anything above that in targetSdkVersion will not show those "three dots".

If you have to necessarily use targetSdkVersion >=11 then implement an ActionBar. This will display the "three dots" but on top right corner. Follow the link to get more details.

Viral Patel
  • 32,418
  • 18
  • 82
  • 110
0

According to this answer you can achieve this by setting the targetSdkVersion in your AndroidManifest.xml to a value less than 14, however this is not a good practice.

Community
  • 1
  • 1
tpbapp
  • 2,506
  • 2
  • 19
  • 21
-1

You Can create an button in an activity with the help of onclick of that button call onCreateOptionsMenu. something like this

Button b=(Button)findviewbyid(R.id.button1);
b.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                onCreateOptionsMenu();
                }              

        });
Rethinavel
  • 3,912
  • 7
  • 28
  • 49
Mario
  • 145
  • 2
  • 16