I have an ImageView
on each row of a ListView
. I set an onLongClickListener
for the ImageView
on the ListView
adapter
as following:
picView.setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View v) {
// TODO Auto-generated method stub
[-- my code for image long click--]
return true;
}
});
In the Activity, I set OnItemClick for the ListView as following:
listViewWord.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
[-- my code for item click--]
return;
}
});
The problem now is, consider the UI design, the Imageview is not large enough, every time I long click the ImageView
and if the finger touch both the image area and the list item, both the [-- my code for image long click--]
and [-- my code for item click--]
will be triggered, which is not what I want. I want to ONLY trigger onLongClick
when I long click the ImageView
. Is there any method to intercept the touch event after the onLongClick
be called? I have returned true
in my onLongClick
;
p.s. If I'm careful enough to only tap the image area, it works fine. So what I'm looking for is some code to intercept the touch event in my picView.setOnLongClickListener
.
Any suggestion will be highly appreciated.