写真に問題があります。に写真がありpicture=sites/default/files/arrow_green_right_0.png
ます。私のアプリケーションでは、この文字列のみを取得します。この文字列の画像をimageViewに表示したいと思います。どうすればそれができますか?
質問する
100 次
2 に答える
2
こんにちは最初に画像のパスを設定し、画像がクラッシュしないように例外を除いて処理する必要があります。以下のコードに従ってください:-
File imgFile = new File(“/sdcard/Images/test_image.jpg”);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageView myImage = (ImageView) findViewById(R.id.imageviewTest);
myImage.setImageBitmap(myBitmap);
}
于 2012-06-04T06:14:15.150 に答える
1
これを試して:
ImageView img = new ImageView(this);
File file = new File(YOUR PATH TO THE IMAGE);
if (file.exists()) {
img.setImageURI(Uri.fromFile(file));
}
于 2012-06-04T06:17:41.597 に答える