SetImageViewBitmap not working in Android widgets

When I try to put a bitmap into a widget, I used this:

theBitmap = Bitmap.createBitmap(WW, HH,
            Bitmap.Config.ARGB_8888);
.
.
// draw something using a canvas
.
.
rviews.setImageViewBitmap(R.id.time,theBitmap);

This works on my phone, but not on my Galaxy Table or Galaxy Note,

if I copy theBitmap to the new ARGB_4444 , then it will work on all devices:

Bitmap clone= theBitmap.copy(Bitmap.Config.ARGB_4444, false); // workaround
rviews.setImageViewBitmap(R.id.time, clone);
+5
source share
1 answer

First, without your workaround, check your logcat output for:

ERROR/JavaBinder(20204): !!! FAILED BINDER TRANSACTION !!!

You will probably exceed the file size limit for an IPC transaction that contains your changes in the hierarchy RemoteViews.

Bitmap.Config.ARGB_4444, 2 , Bitmap.Config.ARGB_8888 ( 2.3 ) 4 [].

, , , . , 1 , , .

:. , , URI . , (, ). /data/data/my.package.name/, , MODE_WORLD_READABLE Context.openFileOutput(). :

remoteViews.setUri(R.id.time, "setImageURI", Uri.fromFile(file));
+6

All Articles