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. Activity versus Service threads

After starting a Service (with startService method) the Activity and
the Service are running in the same thread according to
Thread.currentThread().  I suppose if I start another Activity it will
also be running in that same thread.

So that makes me wonder if there are reasons why the Activity cannot
just call methods on the Service directly and vice versa, once you get
references to the two objects.  What is the role of IBinder that is
better than plain object references?

One reason I am asking is that I have application singleton objects
that I plan to share between the Service and the Activity and I'm
trying to be clear on the design options.

-- 

2. Show Picasa album of a particular user in the app

Hi All,

I want to show the picasa album of a user in my android app. I have
the username/ password + album id of the album. I have tried
implementing via using gdata library. But i am getting a VerifyError
Exception as soon as i run my code.

Following are the gdata libraries that i included in my project:

1) activation.jar
2) gdata-client-1.0.jar
3) gdata-core-1.0.jar
4) gdata-client-meta-1.0.jar
5) gdata-media-1.0.jar
6) gdata-photos-2.0.jar
7) google-collect-1.0-rc1.jar
8) servlet-api.jar.

I am using eclipse 3.4.2 and Google API's[Android 2.2].

I am getting following exception:

11-03 12:00:16.603: WARN/dalvikvm(1702): Unable to resolve superclass
of Lcom/google/gdata/data/media/MediaMultipart; (1746)
11-03 12:00:16.613: WARN/dalvikvm(1702): Link of class 'Lcom/google/
gdata/data/media/MediaMultipart;' failed
11-03 12:00:16.623: ERROR/dalvikvm(1702): Could not find class
'com.google.gdata.data.media.MediaMultipart', referenced from method
com.google.gdata.client.media.MediaService.insert
11-03 12:00:16.623: WARN/dalvikvm(1702): VFY: unable to resolve new-
instance 861 (Lcom/google/gdata/data/media/MediaMultipart;) in Lcom/
google/gdata/client/media/MediaService;
11-03 12:00:16.623: DEBUG/dalvikvm(1702): VFY: replacing opcode 0x22
at 0x0020
11-03 12:00:16.623: DEBUG/dalvikvm(1702): Making a copy of Lcom/google/
gdata/client/media/MediaService;.insert code (256 bytes)
11-03 12:00:16.633: WARN/dalvikvm(1702): VFY: unable to resolve
exception class 1743 (Ljavax/mail/MessagingException;)
11-03 12:00:16.633: WARN/dalvikvm(1702): VFY: unable to find exception
handler at addr 0x55
11-03 12:00:16.633: WARN/dalvikvm(1702): VFY:  rejected Lcom/google/
gdata/client/media/MediaService;.insert (Ljava/net/URL;Lcom/google/
gdata/data/IEntry;)Lcom/google/gdata/data/IEntry;
11-03 12:00:16.643: WARN/dalvikvm(1702): VFY:  rejecting opcode 0x0d
at 0x0055
11-03 12:00:16.643: WARN/dalvikvm(1702): VFY:  rejected Lcom/google/
gdata/client/media/MediaService;.insert (Ljava/net/URL;Lcom/google/
gdata/data/IEntry;)Lcom/google/gdata/data/IEntry;
11-03 12:00:16.643: WARN/dalvikvm(1702): Verifier rejected class Lcom/
google/gdata/client/media/MediaService;
11-03 12:00:16.653: DEBUG/AndroidRuntime(1702): Shutting down VM
11-03 12:00:16.653: WARN/dalvikvm(1702): threadid=3: thread exiting
with uncaught exception (group=0x4001b188)
11-03 12:00:16.663: ERROR/AndroidRuntime(1702): Uncaught handler:
thread main exiting due to uncaught exception
11-03 12:00:16.693: ERROR/AndroidRuntime(1702): java.lang.VerifyError:
com.google.gdata.client.media.MediaService
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
com.agsf.picasa.Welcome.onCreate(Welcome.java:24)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2417)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2470)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.os.Handler.dispatchMessage(Handler.java:99)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.os.Looper.loop(Looper.java:123)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
android.app.ActivityThread.main(ActivityThread.java:4310)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
java.lang.reflect.Method.invokeNative(Native Method)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
java.lang.reflect.Method.invoke(Method.java:521)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-03 12:00:16.693: ERROR/AndroidRuntime(1702):     at
dalvik.system.NativeStart.main(Native Method)


My question is: is it possible to do this on android? If yes, then how
do i do that? Am i missing some library or some other thing.

OR if it is not possible, can you guys point to me on these pages?

Thanks..

-- 

3. LG Optimus and the Rise of the Cheap Androids!

4. Listen/bind a hardwarebutton to a activity/event

5. Can not update app on the Market now

6. Android: DeadObjectException for InputMethodService (SoftKeyboard API sample)

7. How to pass a Context variable from one Activity to another ?