开发者

Calling method in host from gridview adapter

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜