I've been trying to add a functionality to my android application such that when I click a button, menu listing should be visible:
Here is my code:
menu.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.MainActivity" >
<item android:id="@+id/action_onthego_sentence"
android:title="settings"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
From the main activity, upon clicking a button, I do:
button.setOnClickListener( new View.OnClickListener()
{
@Override
public void onClick( View view )
{
runOnUiThread( new Runnable()
{
@Override
public void run()
{
openOptionsMenu();
}
} );
}
} );
What I need is:
As shown in the image, I'd like to see the menu is opened. Any suggestions please?
