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. Usable Screen Size

Hi,
    you can do it by using override method onTouch(), so that u get the
coordinates and calculate the application area.




> 

2. Error wile calling exec("logcat");

Hi All,

I am trying to collect the logcat logs from an application, I created
a thread and run the following code

Process pProcLogMain = Runtime.getRuntime().exec("logcat -f
logcat_main_2.txt");

It creates the file but with no content. And, I get the following
error:
Diag_LSM: Diag_LSM_Init: Failed to open handle to windiag driver,
error = 13

I have used similar code as in
http://code.google.com/p/android-random/source/browse/trunk/Logcat/src/org/devtcg/tools/logcat/LogcatProcessor.java

Appreciate if you can help me how to come over this.

Regards,
-Arun

-- 

3. insert an image in a view at runtime

4. Exception Browser not working

5. download di market stuck

6. Unit Test Build Problems

7. Hello Android Lovers