Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Logging Out

Old Man
Old Man
1,333 Points

Overflow menu does not appear on screen

the 3 dots in the upper right of the main app page (inbox page) do not appear when i run the app in the AVD. the @Override code that appears to create it is present (onCreateOptionsMenu...). but no dots. no overflow menu. any ideas on how to make it appear?

6 Answers

What version of Android are you running? Anything below KitKat (4.4) will not show the overflow items if there is a menu key present on your device/emulator.

This changed in KitKat because Google has been trying to kill off the menu button for a while (Since 2012 according to the Official Android blog), but Samsung (and others) would constantly add menu buttons to their devices instead of the "recents" button.

Check out the commit message on the Android Platform where they now enable the menu items even if the menu button is available!

https://android.googlesource.com/platform/frameworks/base.git/+/ea04f3cfc6e245fb415fd352ed0048cd940a46fe

This is a big deal to developers because, sometimes users would not find the options they were looking for, and had no idea that the menu button existed.

Harry James
Harry James
14,780 Points

Hello, make sure that your XML file in res >> menu >> main.xml contains this line:

   <item android:id="@+id/action_logout" android:title="@string/menu_logout_label"></item>

and that your onCreateOptionsMenu() method looks like this:

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

If you are still having the issue after this, give me a shout :)

Old Man
Old Man
1,333 Points

thanks harry. yes, i seem to have both of those correct. i can get to the logout prompt by hitting the physical "menu" button on the right of the AVD and on the actual android tablet but still do not see the overflow menu dots in the app itself on the main tab (or any other screen.)

Harry James
Harry James
14,780 Points

Do you have the action bar visible though? As in, you can see the Android Icon and the name of the application?

Old Man
Old Man
1,333 Points

yep, that's there. as well as the tab names which are "section 1", "section 2", "section 3" at this point.

Harry James
Harry James
14,780 Points

Ok. I've spent a while looking around the internet for a solution and seem to not be able to find one. If possible, would you be able to export your project (Right click >> Export) and I'll take a look at what you've written and see how to fix it.

Harry James
Harry James
14,780 Points

In the meantime, another thing you could try is adding this to your code:

 <item android:id="@+id/action_logout" android:title="@string/menu_logout_label" android:showAsAction="never"></item>

(Adding the android:showAsAction and setting it to never).

Old Man
Old Man
1,333 Points

thanks guys. ernest, that explains it, thanks.

I ran into this with my actual phone, and I verified the problem with an AVD set for 4.4. You need to edit the AVD details you're working on by setting the Hardware setting, subsection "Hardware Back Home Keys" to NO. When you do this, you will then get the options menu on the emulator. Switch it back to YES, and you'll have to use the Menu button on the emulator.