I have a gridview that is filled with several images using a custom adapter.
The adapter item that shows the images have a download button.
What I want to do is to send a method to the custom adaptar that should be called when the user presses the download button.
In summary: onlinegallery-> associate gridview with adapter sending an onlinegallery 开发者_如何转开发method as parameter gridview adapter -> shows several item.xml each containing an image and a button. item button -> when pressing the button, the onlinegallery method should be called indicating the image to download.
write view.onclickListener in custom adapter then set it using button.ssetonclickListener(listener) in getView overrided method .
whenever you want to pass index specific data to listener, create inner class which implements view.onclickListener , then pass data through constructer ..... or use setTag()/getTag()
精彩评论