課程
/移動(dòng)開發(fā)
/Android
/Android攝像頭基礎(chǔ)
為什么獲取不到拍照后的圖片
2016-06-22
源自:Android攝像頭基礎(chǔ) 2-2
正在回答
android.permission.WRITE_EXTERNAL_STORAGE添加這個(gè)權(quán)限試試
首先檢查照片是否已經(jīng)拍攝成并保存在您的內(nèi)存目錄中。再則就是手機(jī)拍攝的圖片過(guò)大不能直接使用BitmapFactory.decodeFile(file),要通過(guò)文件流的方式讀取使用inputStream;例如:
inputStream = new FileInputStream(imagePath);BitmapFactory.Options opts=new BitmapFactory.Options();opts.inTempStorage = new byte[100 * 1024];opts.inPreferredConfig = Bitmap.Config.RGB_565;opts.inPurgeable = true;opts.inSampleSize = 4;opts.inInputShareable = true;Bitmap bitmap= BitmapFactory.decodeStream(inputStream,null,opts);img.setImageBitmap(bitmap);
舉報(bào)
帶你走進(jìn)Android攝像頭的秘密花園,探索Camera的奧秘
5 回答調(diào)用系統(tǒng)自帶的相機(jī)拍照,獲得不到圖片。
1 回答系統(tǒng)相機(jī)拍照后,圖片保存不了
2 回答拍照后跳轉(zhuǎn)不到Result
2 回答沒有SD卡,拍完的圖片找不到
2 回答拍出來(lái)的圖片不清晰
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-08-01
android.permission.WRITE_EXTERNAL_STORAGE添加這個(gè)權(quán)限試試
2016-06-27
首先檢查照片是否已經(jīng)拍攝成并保存在您的內(nèi)存目錄中。再則就是手機(jī)拍攝的圖片過(guò)大不能直接使用BitmapFactory.decodeFile(file),要通過(guò)文件流的方式讀取使用inputStream;例如:
inputStream = new FileInputStream(imagePath);
BitmapFactory.Options opts=new BitmapFactory.Options();
opts.inTempStorage = new byte[100 * 1024];
opts.inPreferredConfig = Bitmap.Config.RGB_565;
opts.inPurgeable = true;
opts.inSampleSize = 4;
opts.inInputShareable = true;
Bitmap bitmap= BitmapFactory.decodeStream(inputStream,null,opts);
img.setImageBitmap(bitmap);