Android: Dynamically change Image in Listview

Posted by Vivek on Stack Overflow See other posts from Stack Overflow or by Vivek
Published on 2010-12-27T16:07:13Z Indexed on 2010/12/28 0:53 UTC
Read the original article Hit count: 285

Filed under:
|

Hi All,

I have a listview defined by the following xml. I need to toggle the image in the list during runtime when the user clicks on any row. How can I achieve this? Any help is highly appreciated. Thanks

//list_item.xml
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/play" 
android:id="@+id/img"
/> 
<TextView 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:id="@+id/txt"
/>
</LinearLayout>

© Stack Overflow or respective owner

Related posts about android

Related posts about listview