Bitmapオブジェクトに対して何らかの処理 (品質の向上と少しのサイズ変更) を行い、bitmap.compress()関数を使用してファイル名「myfile.png」を付けて保存します。
newbitmap = processImage(bitmap);
FileOutputStream fos = context.openFileOutput("myfile.png", Context.MODE_PRIVATE);
newbitmap.compress(CompressFormat.PNG, 100, fos);
今、この画像をロードしたいのですが、ImageViewそれを行うのに使用setImageBitmap()できません。代替手段はありますか?
使用できない理由setImageBitmap()は、ウィジェットに使用RemoteViewsしており、ビットマップ メソッドを使用すると、画像が大きい場合にFailed Binder Transactionエラーが発生するためです。
以下のコードを使用して画像 uri を設定しようとしましたが、画像が読み込まれません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);
ご協力いただきありがとうございます!