【发布时间】:2014-08-11 01:59:09
【问题描述】:
我目前正在尝试将从手机拍摄的图像保存到其图库中,但只有在弹出选择器对话框时选择库存相机应用程序时,以下代码才有效。每当我选择其他相机应用(例如 Google 相机)时,拍摄的照片都不会保存在任何地方。
为了让事情变得更奇怪,有时图片确实会出现在画廊的指定目录中,但在 15 分钟左右后,当我使用股票相机应用程序时也是如此:图片将保存在默认值中相机镜头目录,但需要相当长的时间才能显示在指定的目录中,如果它显示在那里的话。
// Capturing Camera Image will launch camera app request image capture
void captureImage() {
//file uri to store image.
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
// Request camera app to capture image
Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
// start the image capture Intent
getActivity().startActivityForResult(captureIntent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
}
【问题讨论】:
标签: android image camera gallery android-gallery