change image in dynamic list view
<p>How can i change image in list view at rum time.
I want to change <code>android:layout_toRightOf="@+id/imageView"</code> according to the gender .</p>

<p>here xml</p>

<pre><code>&lt;ImageView
  android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/imageView"
            android:text="20px"
            android:textColor="#dc6800"/&gt;


&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" &gt;

    &lt;RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" &gt;
        &lt;ImageView
            android:id="@+id/imageView"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="21dp"
            android:background="@drawable/people" /&gt;
        &lt;TextView
            android:id="@+id/empid"
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:paddingBottom="1px" 
            android:visibility="invisible"&gt;
        &lt;/TextView&gt;

        &lt;TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/imageView"
            android:text="20px"
            android:textColor="#dc6800"/&gt;

        &lt;/RelativeLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>java code :</p>

<pre><code>    for (Element group : allGroups) {
        String empID = XMLUtil.getNodeValue(group, EMPID );
        String empName = XMLUtil.getNodeValue(group, NAME );
        String gender = XMLUtil.getNodeValue(group, GENDER );
        gropusMap.put(empID , group);

        HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
        map.put(NAME , empName);
        map.put(EMPID , empID);
        if(gender.equalsIgnoreCase("female")){
            map.put(PHOTO , "female");
        }else {
            map.put(PHOTO , "male");
        }

        menuItems.add(map);
    }

    ListAdapter adapter = new SimpleAdapter(this, menuItems , R.layout.list_item, new String[] { NAME, EMPID,PHOTO }, new int[] { R.id.name, R.id.empid ,R.id.imageView });
    setListAdapter(adapter);
    ListView lv = getListView();
    lv.setOnItemClickListener(new OnItemClickListener() {.
</code></pre>

<p>.
..
.
.</p>
