android - Handling touchscreen clicks on context menu -


at context menu select edit object , send information of object.

if long press object on listview emulators buttons information passed normally. if mouse (like touchscreen) information passed other object.

the creation of contextmenu:

  private void onlistviewcreatecontextmenu(contextmenu menu, view v,             contextmenu.contextmenuinfo menuinfo) {          menu.setheadertitle("selected project");         menu.add(0, del, menu.none, r.string.remove);          // define menu item         menuitem menuedit = menu.add(0, edit, menu.none, r.string.edit);          // define intent         intent editintent = new intent(this, pm_edit.class);          // pass row id or project name or whatever..         int itemid = ((listview) v).getselecteditemposition();         itemid = itemid == -1 ? selectedposition : itemid; // set clicked value if none selected         log.v(tag, "selecteditemposition = " + itemid);         editintent.putextra("itemid", itemid);          // set intent menu item         menuedit.setintent(editintent);         ///////////////////////////////////////////////////////////////////////          menu.add(0, task_list, menu.none, r.string.task).setintent(                 new intent(pm_list.this, pm_task_list.class));         menu.add(0, cancel, menu.none, r.string.cancel);     } 


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -