John
John

Reputation: 243

ListView clicklisteners

I have a list view which has a couple of views within it, I have a textView and an ImageView.

What I need to do is, I want a person to be able to click just on the imageView without causing the onItemClicked function to be invoked, If the person clicks the ImageView, it should do something else, but if the person clicks away(apart from the imageview) from the imageView, then the onItemClicked is fired.

How do I do this?

It is kinda like, the listView on the android phone callLogs whereby, the green phone icon is somehow separated from the list but when clicked, it should know which listItem was selected and act accordingly.

I will appreciate the help. Thanks.

Upvotes: 0

Views: 104

Answers (2)

ilango j
ilango j

Reputation: 6037

use holder.imageView.setOnClickListener() in getView() method of adapter class.

Upvotes: 1

Anthony Graglia
Anthony Graglia

Reputation: 5435

Here are some links for you are looking for. Advanced but if you stick with it and dont give up on this, you will learn a ton!!! Take a look:

Android: ListView elements with multiple clickable buttons

Android custom list item with nested widgets

Upvotes: 2

Related Questions