Anshul
Anshul

Reputation: 7964

Android ImageView using old image instead of new image specified in XML file

I have a layout which consists of an ImageView and a TextView. I recently changed android:src for ImageView to a new drawable, but when I am building and running the app on emulator or device its showing the old image instead of the new image that I have specified in XML Layout. I don't understand why the references are not getting updated and android is using the old reference of the image.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_selector"
    android:orientation="horizontal"
    android:padding="3dip" >

    <ImageView
        android:id="@+id/playImage"
        android:layout_width="35dip"
        android:layout_height="35dip"
        android:src="@drawable/play_icon" />

    <TextView
        android:id="@+id/playlistName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:textColor="@color/black"
        android:maxLines="1"
        android:layout_toRightOf="@+id/playImage"
        android:paddingLeft="5dp"
        android:textStyle="bold"
        android:text="Unamed" />
 </RelativeLayout>

Please help me.

Upvotes: 0

Views: 551

Answers (2)

Anshul
Anshul

Reputation: 7964

I did a silly mistake.I was also Setting the ImageView image in my custom adapter and that was overriding the XML ImageView default image.I removed the code of setting image src from adapter and this fixed the issue

Upvotes: 0

suhas_sm
suhas_sm

Reputation: 2114

In such cases, I refresh project folder, clean the project. If these don't work then I will just close and open project. Eclipse acts weird many a times.

Upvotes: 1

Related Questions