0

I am tring to Implement Gallery which contains TextView on ImageView. When user click any of these I need to call some other Activity.

I tried to call setonclickListener on gallery but which always returns result of last item in gallery. If I set onclicklistener on Imageview, gallery stops scrolling.

Is there any way to perform click on both and retrieve the same result and at the same time make gallery scrollable.

Any help is appropriated. Thanks in advance.

Neha
  • 414
  • 1
  • 4
  • 14

1 Answers1

1

Best way to do this, by setting onItemClickListener on GalleryView, in onItemClick() callback method in this class, there would be an integer parameter respresenting position of item. use this parameter, to get which item has been clicked. But to Use this you need to set Clickable and focusable property of individual item imageview to false.

jeet
  • 29,001
  • 6
  • 52
  • 53
  • i need to pass some data to next activity onClick of ImageView/TextView. Please take a look at ImageAdapter class – Neha Aug 29 '12 at 05:14
  • You can return an HashMap in getItem() method, and can use gallery.getAdapter().getItem(position); to get the hashmap in your onItemClick() method. and then can pass these values from the hashmap to another activity. – jeet Aug 29 '12 at 05:24
  • thanks. The Gallery working fine now as i want. – Neha Aug 29 '12 at 07:20