WidgetLayout inside PreferenceActivity displays new then old bitmap...

by Seb » Sat, 24 Oct 2009 00:01:46 GMT


Sponsored Links
 Hi,

I have a PreferenceActivity designed with a .xml file
Inside the .xml, I have:

...
    <Preference
      android:key="picture"
      android:title="Picture"
      android:widgetLayout="@layout/picture"
    />
...

The widgetLayout xml file is a linearlayout with a ImageView inside.
I have set a default drawable src attribute to the ImageView:

android:src="@drawable/test"


When launching, the PreferenceActivity is displayed. The test drawable
as well. Everything is ok.

When I click on the Preference, I have specify to modify the bitmap
inside this widgetLayout as following:

ImageView img = (ImageView) findViewById(R.id.picture_img);
img.setImageBitmap(null);
System.gc();
img.setImageBitmap(newBitmap);


The newBitmap is then well displayed inside the widgetLayout.
I scroll the Preference list (and hide the line that own the
widgetLayout) and then scrolling back to make the line reappear.
Then, the old bitmap is displayed ("@drawable/test")  -----> KO, it
should still display the new bitmap.

I tried to add:
getListView().destroyDrawingCache();
img.invalidate();

But nothing changed...

Can someone help me please ?

Thanks,
Seb.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Having Problems with Layout

I am trYing to define a Layout which is a very simple Linear Layout
that has a TextView and ListView.
My activity is a ListActivity.  I am trying out few things on top of
the Notepad sampleApp. The problem I am facing is TextView and
ListView are displayed in two columns.  I want them displayed one
below the other.  I am not sure what mistake I am making.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
      android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

  <TextView android:id="@+android:id/test"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="test test"
        />
  <ListView android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        />
</LinearLayout>

--~--~---------~--~----~------------~-------~--~----~

2. how to use the Intent.createChooser ...

to display all audio or media application, which were installed at the
android phone?
i don't want to set a media file as extra, i only want to show all
available applications to play audio or media files.

Can somebody help me? Please!

Cheers
Gerby
--~--~---------~--~----~------------~-------~--~----~

3. New web based Gmail

4. MediaRecorder.VideoSource and MediaRecorder.VideoEncoder classes can't be resolved.

5. Getting to Google IO from the UK for the Android talks

6. traceview and dmtracedump fails to start

7. NoClassDefFoundError for a third party library