在Android應用程序中拍攝照片時,顯示模糊/縮小的圖像,我意識到這將來自位圖..... data.getExtras()。得到(「數據」)代碼,但我已經改變的任何東西都沒有工作,顯示的圖像仍然模糊。動作圖像捕捉在觀看時造成圖像模糊
我怎樣才能讓它顯示完整的資源圖片?
相機意向代碼
private void cameraIntent()
{
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
}
在活動代碼
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_CODE_GALLERY)
onSelectFromGalleryResult(data);
else if (requestCode == REQUEST_IMAGE_CAPTURE)
onCaptureImageResult(data);
}
super.onActivityResult(requestCode, resultCode, data);
}
終於oncaptureImageResult - 在那裏,我相信我錯了模糊圖像
private void onCaptureImageResult(Intent data) {
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
thumbnail.compress(Bitmap.CompressFormat.JPEG, 90, bytes);
File destination = new File(Environment.getExternalStorageDirectory(),
System.currentTimeMillis() + ".jpg");
FileOutputStream fo;
try {
destination.createNewFile();
fo = new FileOutputStream(destination);
fo.write(bytes.toByteArray());
fo.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
imageView.setImageBitmap(thumbnail);
}
這似乎並不很不幸改變什麼,一個電話 –