I have a ListView with an ImageView, a TextView and another ImageView in each row.

The code below is the xml of my ListView row:

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#FFF">
<ImageView
android:id="@+id/left"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:src="@drawable/ic_default"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1"
android:textSize="16sp" />
<ImageView
android:id="@+id/right"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/ic_cena_play"
android:layout_marginRight="0dp"
android:layout_marginLeft="10dp"
android:clickable="true"
android:background="@drawable/mybuttonplay" />
</LinearLayout>

```

I have an ArrayList < String > with the names of Drawables I want to put in the first ImageView of the rows. I want to change the ImageViews source "ic\_default" to the ones which have the name in ArrayList, dinamically.

In my Activity, inside onCreate(), I am using an Adapter, as the code below:

```
ArrayList<String> items = new ArrayList();
items.add("Star");
items.add("Moon");
items.add("Dog");
items.add("Bird");
items.add("Tree");
ArrayList<String> itemsimg = new ArrayList();
itemsimg.add("ic_star");
itemsimg.add("ic_moon");
itemsimg.add("ic_dog");
itemsimg.add("ic_bird");
itemsimg.add("ic_tree");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.scenesrow, R.id.text, items) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View row =  super.getView(position, convertView, parent);
            ImageView left = (ImageView) row.findViewById(R.id.left);
            //here I want to change the resource
            //Like if I had a function called getRosourceId(). DOES IT EXIST?!
            int x = getResourceId( itemsimg.get(position) );
            left.setImageResource(x);
            View right = row.findViewById(R.id.right);
            right.setTag(position);
            right.setOnClickListener(ScenesActivity.this);
            return row;
        }
    };

```

**Updated**

Thanks for answers! Now I can change the ImageView source dinamically **(but not yet from the ArrayList < String >)**. The setImageResource() method was not available before because I had a View. With the cast to ImageView you all suggested, big part of the problem was okay. But the answers do not cover the dinamically thing of the "name of the resource".

The last problem now is the left.setImageResource(resId); method asks for an ID from Resource, and I have a String. How to do it?

And sorry, other code version had some mistakes. Now it is fixed. I think the last problem is clear now.