AppWidget setImageViewBitmap issue
以下是Google Code中网友的结论:
I can confirm:
1) Not working
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_1);
remoteViews.setImageViewBitmap(R.id.battery, bitmap);
2) Working
remoteViews.setImageViewResource(R.id.battery, R.drawable.ic_1);
works just fine
3) Working
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_1);
battery = battery.copy(Bitmap.Config.ARGB_8888, true); // workaround
remoteViews.setImageViewBitmap(R.id.battery, bitmap);
Platform: 2.2/FRF50
I use RemoteViews.setImageViewBitmap() to update an image view for my app-
widget. I found the API does not show the bitmap for the ImageView on 2.2.
The code works well for 2.1 and below.
If I change the code to use RemoteViews.setImageViewResource(), it works.
摘自:http://code.google.com/p/android/issues/detail?id=8489