java - Get Item ID From Context Menu -


hey people, trying id of item, in case table row, long pressed bring context menu. code far.

@override public void oncreatecontextmenu(contextmenu menu, view v,                                 contextmenuinfo menuinfo) {   super.oncreatecontextmenu(menu, v, menuinfo);   menuinflater inflater = getmenuinflater();   inflater.inflate(r.menu.context_menu, menu); }  @override public boolean oncontextitemselected(menuitem item) {   adaptercontextmenuinfo info = (adaptercontextmenuinfo) item.getmenuinfo();   switch (item.getitemid()) {       case r.id.delete:            deleteitem(id); //id of item should passed method deleteitem           toast.maketext(this, "delete",                     toast.length_long).show();         return true;       default:         return super.oncontextitemselected(item);   } } 

as can see need id of table row pass method. have tried using info null. missing here you'll able point me in right direction. thanks.

check adaptercontextmenuinfo.id field.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -