开发者

Is there a way to get image name in place of image position in setOnClickListener onClick method under grid view?

I am using grid view example. What i want to know is that is there a way to get the image name 开发者_开发知识库when a user clicks on a particular image? Right now we are able to get the position of the image clicked.

Please help me on this.


First you can used custom gridview like listview..

imageviewname.setTag("yourimagename");

imageviewname.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            String imgname = v.getTag();
            // toast message
        }
    });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜