context menu android -
i have listactivity in android. context menu open when press item of listview.
the problem occurs when close context menu , press same item (the other items have no problems)
if press text, context menu doesn't open, if press in white area contextmenu appears.
¿what's problem?
oncreate method:
lv = getlistview(); lv.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { textview text = (textview) view.findviewbyid(r.id.label); if (!text.gettag().tostring().equals("-1")) { registerforcontextmenu(text); opencontextmenu(text); } } });
if want context menu listview
, call registerforcontextmenu()
in oncreate()
of activity, passing in listview
. here sample project demonstrating this, including showing how determine particular row in listview
user long-tapped upon bring context menu.
Comments
Post a Comment