Android : How can i settag for the images which are in gridview?
<p>Can anyone tell me how can I setTag and getTag for the images which are in gridview.
I have written the following code, but it doesn't work. Is the following code correct or not?</p>

<pre><code>int jj=100;
    for(int j=0;j&lt;imageid.length;j++)//imageid is the array of drawable images
        {
        griview1.getChildAt(j).setTag(jj);
        System.out.println(g.getChildAt(j).getTag());
        }
</code></pre>

<p>this is my getView method</p>

<pre><code>public View getView(int arg0, View arg1, ViewGroup arg2) {
    // TODO Auto-generated method stub

    ImageView imv;
    if(arg1!=null)
    {
        imv=(ImageView)arg1;
    }
    else
    {
        imv=new ImageView(cont);
        imv.setLayoutParams(new GridView.LayoutParams(40,40));
        imv.setScaleType(ScaleType.CENTER_CROP);
        imv.setPadding(0,0,0,0);

        }

    }
    imv.setImageResource(imageid[arg0]);
    return imv;
</code></pre>
