Q: Changing image in a list item in a list view dynamically In my project I have a list view consisting of list items each containing an image. Now when a particular list item is clicked, new activity with respect to that item is opened and it has 3 buttons. Depending on which button is clicked the image in that particular list item is changed.
Each list item is associated with specific row from the database, I wanted to know how do I recognize the particular button click and change image view directly in the list item.
My custom Adapter's getView() Method is as follows
    public class SpecialAdapter extends SimpleCursorAdapter{

    private EventDBAdapter dbHelper;

@SuppressWarnings("deprecation")
public SpecialAdapter(Context context, int layout, Cursor c, String[] from,
        int[] to, int i) {
    super(context, layout, c, from, to);
    // TODO Auto-generated constructor stub
}

private int[] colors = new int[] { 0xAAFFFFF, 0xAAc0c0c0 };

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub


      View view = super.getView(position, convertView, parent);
      int colorPos = position % colors.length;
      view.setBackgroundColor(colors[colorPos]);
      return view;
}

    }

Each list item is inflated from this view
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
 >

<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:layout_toLeftOf="@+id/tvListTitle"
android:paddingLeft="10dp"
android:background="#CC3232"/>

<TextView
    android:id="@+id/tvListTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:layout_marginTop="10dp"
    android:textColor="#108070"
    android:text="Title in list"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/tvListTime"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="00:00 to 00:00"
    android:layout_below="@+id/tvListTitle"
    android:textColor="#138F6A"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/tvListWhere"
    android:layout_width="wrap_content"
    android:layout_below="@+id/tvListTime"
    android:layout_height="wrap_content"
    android:text="Crystal plaza , Andheri (West) . "
    android:textColor="#138F6A"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/tvListDetails"
    android:layout_width="250dp"
    android:layout_below="@+id/tvListWhere"
    android:layout_height="20dp"
    android:text="This is gonna contain brief summary about the event"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/tvListDate"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="14th January"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<TextView
    android:id="@+id/tvListDay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tvListDetails"
    android:text="Monday"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<ImageView
    android:id="@+id/ivStatus"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/tvListWhere"
    android:src="@drawable/yes" />

 </RelativeLayout>


A: You can use startactivityforresult()
OR
Use three static variables in your current activity and set them according to the button pressed in your new activity opened and when comes to the previous activity check the variables and set the image accordingly.

A: Solved , i am using the url of image on SD card and storing it in the sqlite db and populating list view with contents of database row wise
