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

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -