I have a ListView
with Custom Adapter
. I have seen this thread where people asked if the items in the custom view had a clickable item. And Yes, I have a clickable ImageView
in the listrow
. So clicking anywhere else(other than that ImageView
) should perform some other action. I gave an onItemClickListener
to the ListView
. However, it doesn't work on first click and works on two-three clicks.
Update: In my adapter's getView method, I set onClick of ImageView like this:
holder.chatImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//Stuff here
}
});
It works fine, and in my activity, I gave onItemClickListener
to listView likw this:
onlineListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView parent, View view,
int position, long id) {
//Stuff here
}
});
PS: I didn't explicitly give any focus to anything.