I am trying to create an Options menu in an Activity that gets started from a Service and then changes its UI based on messages from the Service passed via a Handler.
I set up the Options menu as follows:
/** Menu creation and setup **/
/* Creates the menu items */
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, 1, 0, "Speaker");
menu.add(0, 2, 0, "Mute");
return true;
}
/* Handles item selections */
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case 1:
//Do something here
return true;
case 2:
//Do something here
return true;
}
return false;
}
But it never gets called when my application is run at all.
I have experienced problems where I need to use a Handler to change Text on the screen as the information is being passed on the wrong thread, could this same issue be the cause of the menu not displaying?
Is so how can I fix it as I cant override a method in a Handler