0
画像を撮影してアプリケーションにロードして画像を保存しようとしています。しかし、私が直面している問題は、常に別の名前で保存されている画像なので、読み込めませんでした。 (私はファイルマネージャーをチェックして、別の名前で保存された写真を見ました)。MediaStore.ACTION_IMAGE_CAPTUREは常に別の名前で画像を保存します
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File
}
// Continue only if the File was successfully created
if (photoFile != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(takePictureIntent, RESULT_TAKE_PHOTO);
}
}
private File createImageFile() throws IOException {
// Create an image file name
String imageFileName = "puzzle";
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = "file:" + image.getAbsolutePath();
return image;
}
いつも別の名前で保存する理由はわかりません。