Reputation: 1226
If set tooltip text in adapter:
public View getView(int position, View convertView, ViewGroup parent){
convertView.setTooltipText( convertView.getContext().getString(R.string.level )+" "+(position+1) );
///..........
}
Then onItemClickListener
is not working. What is wrong?
Upvotes: 0
Views: 20
Reputation: 71
I faced this issue in one of my older project and here is the reason, setting the tooltip text directly on the convertView can block touch events, which are needed for the onItemClickListener to work.
I was able to resolve the issue by setting the tooltip text on a child view of the convertView. After doing this touch events were not blocked, and the onItemClickListener was working correctly.
Please refer below code snippet:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = convertView.findViewById(R.id.view_id);
textView.setTooltipText(convertView.getContext().getString(R.string.level) + " " + (position + 1));
return convertView;
}
Upvotes: 0