Yuliya Tarasenko
Yuliya Tarasenko

Reputation: 437

Created file is not visible in the gallery, but is visible in a sdcard folder

I've added a video file in /mnt/sdcard/DCIM/somefolder But it is not visible in the gallery. Could anyone help me please to understand what is wrong?

File dir = new File(Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_DCIM), "/somefolder");
    if (!dir.exists()) {
        dir.mkdirs();
    }

    mrec.setOutputFile(dir.getPath() + "/video" + ".mp4");

Upvotes: 2

Views: 1864

Answers (1)

SubbaReddy PolamReddy
SubbaReddy PolamReddy

Reputation: 2113

just add these lines:

sendBroadcast(new Intent(
Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));

Upvotes: 6

Related Questions