0

イメージビューで画像を表示しようとしています。で画像パスを渡すことで実行できることを知っていますsetImageBitmap()

もうやった。内部の問題により、エミュレータのパフォーマンスが低下したため、エミュレータをGoogleからIntel x86に変更しました。その時点から、画像に関連するアプリケーションが正しく動作しません。イメージビューでの画像の表示に関して何か問題はありますか?

画像表示のコード スニペット:

try
                {
                         path = info.getPath(); //this variable contains the filename of the image.
                         File sdCardPath = Environment.getExternalStorageDirectory(); // code to get the path of the folder storing the image file
                         Bitmap bitmap = BitmapFactory.decodeFile(sdCardPath+"/DCIM/Camera/SAMPLE IMAGES/"+path);
                         jpgView.setImageBitmap(bitmap);
          Toast.makeText(getApplicationContext(), "This is reg pic : "+sdCardPath+"/DCIM/Camera/SAMPLE IMAGES/"+path, Toast.LENGTH_SHORT).show(); }
                catch(NullPointerException er) 
               {
                        String ht=er.toString();
                        Toast.makeText(getApplicationContext(), ht, Toast.LENGTH_SHORT).show();
                }

画像ファイルは次のように保存されます -

ここに画像の説明を入力

4

1 に答える 1

0

エミュレータを Google から Intel x86 に変更したため、イメージ パスが変更されます

このように猫をログに記録すると、エラーが表示されるはずです

E/BitmapFactory(1961): Unable to decode stream: java.io.FileNotFoundException: /mnt/sdcard/abc.jpg: open failed: ENOENT (No such file or directory)

画像をもう一度選択して、アプリケーションから画像パスを更新してみてください

于 2013-09-18T05:56:37.813 に答える