用相机拍照,但找不到缩略图



我从相机中获得照片,但在我拍摄的照片中没有带有以下代码的官方印章。

代码:

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
photo = this.createTemporaryFile("photo", ".jpg");
photo.delete();
cekilenResimUri = Uri.fromFile(photo);
intent.putExtra(MediaStore.EXTRA_OUTPUT, cekilenResimUri);
startActivityForResult(intent, KAMERADAN_RESIM_AL);

onActivity结果:-

this.getContentResolver().notifyChange(cekilenResimUri, null);
ContentResolver cr = this.getContentResolver();
BitmapFactory.Options options = new BitmapFactory.Options();
cekilenResim = BitmapFactory.decodeFile(cekilenResimUri.getPath(), options);
editorResim.setImageBitmap(cekilenResim);

我怎样才能克服这个问题?

如果您能够将捕获的图像作为位图。但是找不到缩略图,只能在图库中添加图片。您可以通过以下几行添加它:

private void galleryAddPic() {
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
File f = new File(mCurrentPhotoPath);
Uri contentUri = Uri.fromFile(f);
mediaScanIntent.setData(contentUri);
this.sendBroadcast(mediaScanIntent);
}

最新更新