Java strange problem
<p>I am bit poor at java or better to say OOP's I have a strange problem, I wonder if thats possible. I have a class</p>

<pre><code>private ArrayList&lt;?&gt; data;
public A(Activity a, ArrayList&lt;?&gt; mStatus)
{
    activity = a;
    data = mStatus;
    inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    imageLoader = new ImageLoader(activity.getApplicationContext());
}
</code></pre>

<p>later i used</p>

<pre><code>public View getView(int position, View convertView, ViewGroup parent)
{
    View vi = convertView;
    ViewHolder holder;
    if (convertView == null)
    {
        vi = inflater.inflate(R.layout.custom_gallery, null);
        holder = new ViewHolder();
        holder.text = (TextView) vi.findViewById(R.id.text);
        holder.image = (ImageView) vi.findViewById(R.id.image);
        holder.root = (LinearLayout) vi.findViewById(R.id.root);
        vi.setTag(holder);
    }
    else
        holder = (ViewHolder) vi.getTag();

    //I used this that solves my problem
    if(data.get(position) instanceof GalleryTestParser)
    {
        GalleryTestParser mParser = (GalleryTestParser)data.get(position);
        holder.text.setText(mParser.Name);
        holder.image.setTag(mParser.galleryThumbiPad);
        holder.root.setTag(mParser);
        imageLoader.DisplayImage(mParser.galleryThumbiPad, activity, holder.image);
    }


    return vi;
}
</code></pre>

<p><strong>Edit: Above I want if data is of type GalleryTestParser or if some other than do something else.</strong></p>

<p>earlier I was trying <code>ArrayList&lt;GalleryTestParser&gt; mStatus</code> in constructor but that is class specific. What I want is that from object of arraylist somehow I must know what type of it is so that I type cast arraylist object to that type.</p>

<p>Is that possible ?</p>
