【发布时间】:2016-12-13 08:24:11
【问题描述】:
通过使用相机意图在我的应用中拍照,图像从 SD 卡和图库中复制。这是我的拍照代码:
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = "file to /storage/emulated/0/Pictures/folder/image.jpg"
} catch (IOException ex) {
// Error occurred while creating the File
Log.e("Can't create file", ex.getLocalizedMessage());
}
Uri photoUri = Uri.fromFile(photoFile);
// Continue only if the File was successfully created
if (photoFile != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(takePictureIntent, CAMERA_REQUEST_CODE);
}
图像保存到photoFile,另一个相同的图像保存到图库。如何解决?
【问题讨论】:
标签: android android-intent camera android-camera-intent