title: changing image on listview at runtime in android
body: <p>I am using a LinearLayout to display some Text and image. I have the images at drawable/ and i am implimenting this with ListActivity with some onListItemClick functionality. now i wants to change the image for the rows which are processed by onclick functionality to show the status as processed. can some one help me in this issue to change the image at runtime.</p>
  
  <p>the following is my implimentation.</p>
  
  <p>public class ListWithImage extends ListActivity {
      /** Called when the activity is first created. */</p>
  
  <p>private SimpleCursorAdapter myAdapter;</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
   // raj   setContentView(R.layout.main);
  
      Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
      startManagingCursor(cursor);
  
      String[] columns = new String[] {People.NAME, People.NUMBER};
      int[] names = new int[] {R.id.contact_name, R.id.contact_number};
  
      myAdapter = new SimpleCursorAdapter(this, R.layout.main, cursor, columns, names);
      setListAdapter(myAdapter);
  
  }
  
  
  @Override
  protected void onListItemClick(ListView listView, View view, int position, long id) {
      super.onListItemClick(listView, view, position, id);
  
      Intent intent = new Intent(Intent.ACTION_CALL);
      Cursor cursor = (Cursor) myAdapter.getItem(position);
      long phoneId = cursor.getLong(cursor.getColumnIndex(People.PRIMARY_PHONE_ID));
      intent.setData(ContentUris.withAppendedId(Phones.CONTENT_URI, phoneId));
  
      startActivity(intent);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and main.xml is :</p>
  
  <p>
  </p>
  
  <pre><code>&lt;LinearLayout
      android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="250px"&gt;
   &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" android:orientation="horizontal"&gt;
  
     &lt;TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="Name: " /&gt;
  
     &lt;TextView android:id="@+id/contact_name"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" /&gt;
  &lt;/LinearLayout&gt; 
      &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" android:orientation="horizontal"&gt;          
     &lt;TextView
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="Phone: " /&gt;       
     &lt;TextView android:id="@+id/contact_number"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" /&gt;
  &lt;/LinearLayout&gt;  
  </code></pre>
  
  <p><br>
       
  </p>
  
  <p>I thought to add the field to DB. but i was unable to know how to change the image with code. can any one provide me an example for drawing image with code and change it based on a condition at runtime.</p>