【发布时间】:2014-02-14 11:04:57
【问题描述】:
我不知道如何打开保存的图像并将其显示到gridView中。
我打算拍照:
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null && file != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
文件保存在/data/data/package/files/... 但是当我尝试打开文件并创建位图时,它总是返回 null。
try {
is = this.getContentResolver().openInputStream(Uri.fromFile(f));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Bitmap bitmap = BitmapFactory.decodeStream(is);}
即使我使用 decodeFile method() 我仍然有一个空位图。 文件存在于 data/data/ ...我检查了它。
我的问题是:我怎样才能得到显示拍摄的图像?
【问题讨论】:
-
意味着你想在你的应用程序中拍摄所有画廊照片是你的意思
-
是的,我更喜欢将图片保存在 data\data 中而不是画廊中
标签: android bitmap android-camera