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
}
});
精彩评论