Example usage for android.os Environment getExternalStoragePublicDirectory

List of usage examples for android.os Environment getExternalStoragePublicDirectory

Introduction

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

Prototype

public static File getExternalStoragePublicDirectory(String type) 

Source Link

Document

Get a top-level shared/external storage directory for placing files of a particular type.

Usage

From source file:Main.java

public static String getPluginPath(String dirType) {
    return Environment.getExternalStoragePublicDirectory(dirType).getPath();
}

From source file:Main.java

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

From source file:Main.java

public static File getAlbumDir() {
    File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
            getAlbumName());//w  w w  .ja v a2 s.c o m
    if (!dir.exists()) {
        dir.mkdirs();
    }
    return dir;
}

From source file:Main.java

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

From source file:Main.java

public static Uri getOutputUri() {
    File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    if (dir.exists() == false) {
        dir.mkdirs();/*from   ww w .j av  a 2s  .  c o  m*/
    }
    File file = new File(dir, "photo.png");
    return Uri.fromFile(file);
}

From source file:Main.java

public static String getDirPath() {
    File mediaStorageDir = new File(
            Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Dove");
    if (!mediaStorageDir.exists())
        return null;
    else//from   ww w .  j  av a 2s. co m
        return mediaStorageDir.getPath();

}

From source file:Main.java

public static File createImageInExternalStoragePublicDirectory(String filename) {

    File path = Environment.getExternalStoragePublicDirectory("uDrove");
    File file = new File(path, filename + ".jpg");
    path.mkdirs();/*from  w ww.  j  a  v  a  2  s.  c  o  m*/

    return file;

}

From source file:Main.java

public static File getDir() {
    File sdDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    return new File(sdDir, ASKEM_DIRECTORY);
}

From source file:Main.java

public static File getAlbumStorageDir() {
    return new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), ALBUM_NAME);
}

From source file:Main.java

public static String getFolderName(String name) {
    File mediaStorageDir = new File(
            Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), name);

    if (!mediaStorageDir.exists()) {
        if (!mediaStorageDir.mkdirs()) {
            return "";
        }//from   w  ww . j  a v a  2  s.c om
    }
    return mediaStorageDir.getAbsolutePath();
}