mercredi 20 mai 2015

Can we trigger onItemClick() method of listview with one member view of single list item

If single item of a list has 2 members, one TextView and other ImageView to be displayed in the ListView then it seems like "arg1"(as shown in the code below) is the whole view of one concrete item (containing 2 items "TextView+ImageView" but not view of one item like "ImageView"). I wanna implement the logic only on the click of ImageView but not on the click of whole single item view.

I tried this way but that's not working :(.

 this.getListView().setOnItemClickListener(
            new AdapterView.OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> arg0,
                                               View arg1, int arg2, long arg3) {
                   if(arg1.getId()==R.id.imageView){
                        //some logic here should be executed only when imageView is clicked but not textView
                   }
                }
            });

Aucun commentaire:

Enregistrer un commentaire