Reputation: 1211
I have a Button/Edittext to reset my App-Settings....
If a press the button(no long click), I want to get a Contextmenu with a Button where i can confirm the reset or not!
Which listener do i need for my Button to call a ContextMenu?
Is a also possible to create a contextmenu by this method?
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//create Contextmenu to confirm or not
return true;
}
return super.onKeyDown(keyCode, event);
}
and how can i get a Textview or a Button in a ContextMenu() ?!? Do u have any suggestions?
Upvotes: 0
Views: 488
Reputation: 87064
I don't think you can actually start the ContextMenu
on a Button
click(this menu could be handled directly by the Android system).
You should use a Dialog
(or AlertDialog
) to get your user choice.
Upvotes: 1