I do some processing (quality improvement and a little resizing) on ββthe Bitmap object, and then save it using the bitmap.compress() function, specifying the file name "myfile.png".
newbitmap = processImage(bitmap); FileOutputStream fos = context.openFileOutput("myfile.png", Context.MODE_PRIVATE); newbitmap.compress(CompressFormat.PNG, 100, fos);
Now I want to load this image into ImageView , but I cannot use setImageBitmap() for this. Is there an alternative?
The reason I cannot use setImageBitmap() is because I use RemoteViews for the widget, and using the bitmap method results in a Failed Binder Transaction error when the image is large.
I tried installing the uri image using the code below, but the image does not load on ImageView :
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout); File internalFile = context.getFileStreamPath("myfile.png"); Uri internal = Uri.fromFile(internalFile); rv.setImageViewUri(R.id.widgetImageView, internal); updateAppWidget(awID, rv);
Thanks for your help!
source share