开发者

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

开发者 https://www.devze.com 2023-03-09 11:08 出处:网络
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 t

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

精彩评论

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