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

First you can used custom gridview like listview.

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 } }).

Thanks nik for replying. I have a variable newtext0 which contains name of the image e.g. Profile1. Jpg imageviewname.

SetTag(newtext0); I have also added String imgname=(String) v.getTag(); But I am getting 06-01 12:37:10.386: ERROR/AndroidRuntime(586): java.lang. NullPointerException 06-01 12:37:10.386: ERROR/AndroidRuntime(586): at blog.android.sdcard. SDCardImagesActivity$ImageAdapter.

GetView(SDCardImagesActivi?ty. Java:137) – Pankaj Khurana Jun 1 '11 at 7:10 can you paste you code? – Nik.... Jun 1 '11 at 7:14 I have resolved it myself.

It was due to variable scope conflict. Declaring a global variable and storing the newtext0 in this variable resolved the issue. – Pankaj Khurana Jun 1 '11 at 7:23.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions