我正在通过相机应用程序捕获图像并希望存储在特定文件夹中,但图像未存储在文件夹中,这是我的代码:
File dir = new File(Environment.getExternalStorageDirectory().getPath() + "/" + "my_data");
try {
if (!dir.exists())
if (dir.mkdir()) {
System.out.println("Directory created");
Toast.makeText(Add.this, "created dir",
Toast.LENGTH_LONG).show();
}
image_path = Environment.getExternalStorageDirectory().getPath() + "/my_data/" + aa + "_image.jpg";
File file = new File(dir,image_path);
uriImage = Uri.fromFile(file);
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriImage);
startActivityForResult(intent,CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);