android - onTextContextMenuItem is not called on custom menu items -
I'm trying to add some custom menu items to some EditText-instances. I appear in the menu, but When I click the onTextContentMenuItem-method button, if there is such a topic then EditText-instances are in the list list.
Any advice on this matter?
The relevant code:
class document spreadsheet editingText {public documentfeedment (reference reference) {extends} in super (context); } @ Override Public Zero to Cretecontext Menu (context menu menu) {menu.add (menu.catigree_ALTERNATIVE, CONVERT_TO_H1, menu.NOn, "convert to H1"); Menu.add (menu.CATEGORY_ALTERNATIVE, CONVERT_TO_P, Menu.NONE, "Convert to P"); Super.onCreateContextMenu (menu); } @override public boolean on text context menu (iid) {log. ("Id", string.value (id)); // CONVERT_TO_ {H1, P} never returns the return icon Super .ontextContextMenuItem (ID); }}
It is very easy ... after viewing in TextView
source ...
First of all, implement your EditText MenuItem.OnMenuItemClickListener
Will be> class
Secondly, you have to implement onMenuItemClick
for the interface, such as
@Override Public Boolean Paramunium item (menu items) {return onTextContextMenuItem ( Item.getItemId ()); }
Last, add each menu item to the listener
menu.add (Menu.NONE, MyMenu, Menu.CATEGORY_SECONDARY, "menu text") ) .setOnMenuItemClickListener (this);
Comments
Post a Comment