Azmat
Azmat

Reputation: 393

Selected Item of row in ListView

Hi I am using a Listview in my application and I created separate xml for the layout of each row of that ListView. Each row contains two ImageView and one One TextView. I want to get which ImageView is clicked on that row.

Upvotes: 0

Views: 136

Answers (3)

user4232
user4232

Reputation: 592

convertView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                        system.out.println("position"+position)
                             }});

Upvotes: 0

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

put the tag with each imageView in getView function of the adapter....

imageView.setTag(Postion);

and get in onclick with view that you received......

Upvotes: 1

Lalit Poptani
Lalit Poptani

Reputation: 67286

You can set OnClickListener in Adapter class itself inside getView() and get the Click Listener working for both the images. As, you haven't posted any code it not feasible to guess.

Upvotes: 2

Related Questions