so i've connected context menu pop list view in fragment. items show up, when click on them, oncontextmenuitemselectedmenu()
ignored , instead onmenuitemclick()
called in parent activity. how can make when click context menu items oncontextmenuitemselectedmenu()
called in fragment instead. thanks.
@override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); menu.add("item1"); menu.add("item2"); menu.add("item3"); } @override public boolean oncontextitemselected (android.view.menuitem item){ log.i("ctest", "clicked context menu"); return true; }
i figured out. it's turned out same buttons. both in fragment:
@override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo){ super.oncreatecontextmenu(menu, v, menuinfo); menu.add("item0").setonmenuitemclicklistener(this); menu.add("item1").setonmenuitemclicklistener(this); } @override public boolean onmenuitemclick(menuitem item){ if(itemname.equals("item0)) { } else if (itemname.equals("item1")) { } }
Comments
Post a Comment