Kintarō
Kintarō

Reputation: 3187

Cannot save image in an Android app

I am working on an app that uses other camera apps to take a picture. I can successfully launch another camera app but I don't see the picture is saved into my desired folder. Here is my code:

        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        File imagesFolder = new File(Environment.getExternalStorageDirectory(), "MyImages");
        imagesFolder.mkdirs();
        File image = new File(imagesFolder, "image_001.jpg");
        Uri uriSavedImage = Uri.fromFile(image);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage); 
        startActivityForResult(intent, 0);

I expected MyImages folder will be created but I couldn't find it on my device.

Thanks for the help!

Upvotes: 0

Views: 296

Answers (1)

Pratik Sharma
Pratik Sharma

Reputation: 13415

Check with this permission in Manifest file:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Upvotes: 1

Related Questions