1
在我的程序中,我必須將圖像路徑更改爲位圖。圖像路徑已經退出,但是當我更改爲位圖時,位圖始終顯示爲空。我不知道發生了什麼事。這是我的代碼。位圖始終顯示空?
String dirName = Environment.getExternalStorageDirectory().toString()+picturePath;
File sddir = new File(dirName);
Bitmap myBitmap = BitmapFactory.decodeFile(sddir.getAbsolutePath());
//Drawable d = new BitmapDrawable(getResources(), myBitmap);
Log.i("mybitmap",myBitmap+"");
Log.i("dirName",dirName+"");
Log.i("FileName",sddir+"");
請給我一些建議...
編輯:logcat的輸出:
01-19 11:56:18.085: I/mybitmap(1469): null
01-19 11:56:18.085: I/dirName(1469): /mnt/sdcard/mnt/sdcard/447650.jpg
01-19 11:56:18.085: I/FileName(1469): /mnt/sdcard/mnt/sdcard/447650.jpg
01-19 12:19:59.754: I/PicturePath(1671): /mnt/sdcard/62afbdb0c0d287195c0eb7793427b8b8.jpg
「圖像路徑已經退出」是什麼意思? –
我的意思是圖像路徑退出。我知道它是因爲Log.i顯示圖片路徑。 – Halo
'Environment.getExternalStorageDirectory()。toString()+ picturePath'的返回值是什麼?你可以發佈'dirName'字符串值... –