Try looking at:
AdapterView.onItemLongClick()
ListView implements AdapterView, so you'll have access to that juicy
method, which will pass the id of the item clicked as well as the
item's view the same as with onListItemClick().
{begin code}
// ListActivity has a ListView, which you can get with:
ListView lv = getListView();
// Then you can create a listener like so:
lv.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener
(){
@Override
public boolean onItemLongClick(AdapterView<?> av, View v, int
pos, long id) {
onLongListItemClick(v,pos,id);
return false;
}
});
// You then create your handler method:
protected void onLongListItemClick(v,pos,id) {
Log.i( TAG, "onLongListItemClick id=" + id );
}
{end code}
The standard onListItemClick() will still fire as well; my best guess
there is to keep a suppression boolean around, which isn't pretty.
Any other thoughts on this?
Phrases I searched for before finally stumbling across the proper
docs:
listactivity hold
listactivity longclick
android list long click
listactivity long click
listactivity long touch
android listview onLongClickListener
On Jan 2, 4:04 am, "
tranbinh.b...@gmail.com" <
tranbinh.b...@gmail.com>
wrote: