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

Three dots in ActionBar does not appear.

2 Answers

Ilya Liverts
Ilya Liverts
9,677 Points

This is an awful hack that breaks consistency with the rest of the apps on the platform, but its works. Put this code in onCreate() method of MainActivity.java after setContentView(R.layout.activity_main);

try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
            if(menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

I got the answer and it was what everyone repeatedly says: With the device that has physical menu button, overflow does not appear. I literally never use this button since,,, come on, who uses for what? Sorry, but at least for me, it is useless button. And this way I didn't realize my device has it. Besides, Twitter app or Facebook app has overflow so I thought this device is "the one that can display it". Maybe those apps has got another way to achieve it.

Ilya Liverts
Ilya Liverts
9,677 Points

Maybe , thank you for your reply :)