I am trying to add click listner on my viewflipper which contains dynamic image. but i am unable to implement click listener for image inside the view flipper. how can i do that? i searched in this site and did not help my self:
below is my code sample:
for (int i = 0; i < post.getImages().size(); i++) {
ImageView image = new ImageView(MyActivity.this);
Picasso.get().load(room.getImages().get(i)).into(image);
viewFlipper.addView(image);}
(P.S. I want click listener for my images)
You can just use
viewFlipper.getChildAt(i).setOnClickListener(..)inside your for loop.getChildAt(int index): Returns the view at the specified position in theviewflipper.see docs for more viewgroup's implementation