java - setOnLongClickListener with registerForContextMenu -
i want actions before show context menu...
is possible use both??
i tried:
name.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view v) { //some code here before show context menu registerforcontextmenu(name); return true; } });
but didn't work
thanks
edit: have
for (final file dir : dirs) { tablerow row = new tablerow(this); final button name = new button(this); name.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view v) { //dir global variable. saves clicked path dir = dir.getabsolutepath()+"/"; //registerforcontextmenu(name); return true; } }); row.addview(name); fileview.addview(row); }
as can see want show context menu after save path of clicked item
you can place these actions in oncreatecontextmenu()
of activity. react differently on different views 1 or more tags (arbitrary objects) can associated each view , read in oncreatecontextmenu()
. methods view.settag()
, view.gettag()
.
Comments
Post a Comment