-1

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)

iamnabink
  • 454
  • 9
  • 27
Anita
  • 7
  • 10

1 Answers1

0

You can just use viewFlipper.getChildAt(i).setOnClickListener(..) inside your for loop.

getChildAt(int index) : Returns the view at the specified position in the viewflipper.

see docs for more viewgroup's implementation

iamnabink
  • 454
  • 9
  • 27