这是创建我的文件夹和图像的功能
String mCurrentPhotoPath;
private File createImageFile() throws IOException {
// Create an image file name
File folder = new File(Environment.getExternalStorageDirectory() + File.separator + "MyFolder");
if (!folder.exists()) {
success = folder.mkdir();
}
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "Photo" + timeStamp + "_";
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg",
folder/* directory */
);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = image.getAbsolutePath();
return image;
}
这就是创造
的内容mbtnCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
createImageFile();
} catch (IOException e) {
e.printStackTrace();
}
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
onActivityResult(0,0,intent);
}
});
它创建了一个.jpg文件但不可更改。拍摄照片时,它也在相机文件夹中并且可读,但在我的新文件夹中无法读取。有人可以解释一下原因吗?