Example usage for android.os Environment DIRECTORY_DCIM

List of usage examples for android.os Environment DIRECTORY_DCIM

Introduction

In this page you can find the example usage for android.os Environment DIRECTORY_DCIM.

Prototype

String DIRECTORY_DCIM

To view the source code for android.os Environment DIRECTORY_DCIM.

Click Source Link

Document

The traditional location for pictures and videos when mounting the device as a camera.

Usage

From source file:Main.java

public static String getDCIM() {
    return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + "/";
}

From source file:Main.java

public static String getDCIMpath() {
    return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
}

From source file:Main.java

public static String getCameraFolder() {
    return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
}

From source file:Main.java

private final static File getDcimRoot() {
    return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.FROYO)
public static File getDCIMFile() {
    return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
}

From source file:Main.java

public static File getDir() {
    String rootDir = "";

    if (Environment.isExternalStorageEmulated()) {
        rootDir = Environment.getExternalStorageDirectory().toString() + "/" + Environment.DIRECTORY_DCIM;
    } else {/*w ww  .ja v  a  2  s .co  m*/
        rootDir = Environment.getDataDirectory().toString() + "/" + Environment.DIRECTORY_DCIM;
    }
    File imageDirectory = new File(rootDir);

    if (!imageDirectory.exists()) {
        imageDirectory.mkdirs();
    }

    return imageDirectory;
}

From source file:Main.java

private static String generateDCIM() {
    return new File(Environment.getExternalStorageDirectory().toString(), Environment.DIRECTORY_DCIM)
            .toString();/*  www .  ja  v a2s.co  m*/
}

From source file:Main.java

public static File getMediaCopyFolder(Context context) {
    File mediaCopyFolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),
            MEDIA_PUBLIC_FOLDER_NAME);/*from   ww w .  j  a  v  a 2  s  .c  o  m*/

    if (mediaCopyFolder.exists()) {
        // Log.d(TAG, "Media folder exist: " + mediaCopyFolder);
    } else {
        mediaCopyFolder.mkdirs();

        // Log.d(TAG, "Media folder created: " + mediaCopyFolder);
    }

    return mediaCopyFolder;
}

From source file:Main.java

public static String getPhotoSavePath() {
    String dcimDir = null;//www  . j  a  v  a 2  s  .c om

    File extDcimDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
    if (extDcimDir == null || !extDcimDir.exists()) {
        File extDir = Environment.getExternalStorageDirectory();
        if (extDir == null) {
            return null;
        }
        dcimDir = extDir.getAbsolutePath() + "/DCIM";
        try {
            new File(dcimDir).mkdirs();
        } catch (Exception e) {
        }
    } else {
        dcimDir = extDcimDir.getAbsolutePath();
    }
    return dcimDir + PHOTO_FOLDER;
}

From source file:Main.java

/**
 * Determine the camera folder. There seems to be no Android API to work for real devices, so this is a best guess.
 *
 * @return the default camera folder./*from w  w w  .j  av  a  2  s  .c om*/
 */
public static String getDefaultCameraFolder() {
    File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
    if (path.exists()) {
        File test1 = new File(path, "Camera/");
        if (test1.exists()) {
            path = test1;
        } else {
            File test2 = new File(path, "100ANDRO/");
            if (test2.exists()) {
                path = test2;
            } else {
                path = new File(path, "100MEDIA/");
            }
        }
    } else {
        path = new File(path, "Camera/");
    }
    return path.getAbsolutePath();
}