Example usage for java.io File mkdir

List of usage examples for java.io File mkdir

Introduction

In this page you can find the example usage for java.io File mkdir.

Prototype

public boolean mkdir() 

Source Link

Document

Creates the directory named by this abstract pathname.

Usage

From source file:Main.java

public static File getAlbumDir() {
    File f = new File(Environment.getExternalStorageDirectory(), "moneycat");
    if (!f.exists()) {
        f.mkdir();
    }/*from   w w  w  . j  a  v a  2s . c  o  m*/
    return f;
}

From source file:Main.java

public static String createTbutlerFolder() {
    String folder = "/sdcard/tbutler";
    if (checkState()) {
        try {/*from  ww  w.  ja va  2 s  .c  o  m*/
            File file = new File(folder);
            if (!file.exists()) {
                file.mkdir();
            }
        } catch (Exception er) {
            Log.e(tag, "error creating folder", er);
        }
    }
    return folder + "/";
}

From source file:Main.java

public static void checkSDPrivateFolder() {
    String folderPathString = getSDPath() + mPrivatePath;
    File path = new File(folderPathString);
    if (!path.exists()) {
        path.mkdir();
    }//  w  ww. j av a2 s.  c  o  m

    String folderPathString2 = getDataPublicPath();
    path = new File(folderPathString2);
    if (!path.exists()) {
        path.mkdir();
    }
}

From source file:Main.java

public static File createSDDir(String dirName) {
    File file = new File(SDPATH + dirName);
    if (file.exists()) {
        return file;
    }/*  ww  w. ja  v  a  2  s .co  m*/
    file.mkdir();
    return file;
}

From source file:Main.java

public static void makeDirectory() {
    File file = new File(Environment.getExternalStorageDirectory() + "/Music");
    if (!file.exists()) {
        file.mkdir();
    }/*from   w  w w  .  jav a 2  s  . com*/
}

From source file:Main.java

public static File getCecheFolder(Context context) {
    File folder = new File(context.getCacheDir(), "IMAGECACHE");
    if (!folder.exists()) {
        folder.mkdir();
    }//ww w .ja v  a  2 s.  c  o  m
    return folder;
}

From source file:Main.java

public static File getCecheFolder(Activity activity) {
    File folder = new File(activity.getCacheDir(), "IMAGECACHE");
    if (!folder.exists()) {
        folder.mkdir();
    }//from   w  w w . j a v  a2  s . c  om
    return folder;
}

From source file:Main.java

public static void saveMyBitmap3(String bitName, Bitmap mBitmap) throws IOException {
    String myJpgPath = Environment.getExternalStorageDirectory() + "/pepper/" + "3.png";
    File tmp = new File("/sdcard/pepper/");
    if (!tmp.exists()) {
        tmp.mkdir();
    }/*from   w  w w . j av  a 2  s  . c  om*/
    File f = new File(myJpgPath);
    f.createNewFile();
    FileOutputStream fOut = null;
    try {
        fOut = new FileOutputStream(f);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
    try {
        fOut.flush();
        fOut.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void saveMyBitmap2(String bitName, Bitmap mBitmap) throws IOException {
    String myJpgPath = Environment.getExternalStorageDirectory() + "/pepper/" + "2.png";
    File tmp = new File("/sdcard/pepper/");
    if (!tmp.exists()) {
        tmp.mkdir();
    }/*from   w  ww . jav  a 2s.com*/
    File f = new File(myJpgPath);
    f.createNewFile();
    FileOutputStream fOut = null;
    try {
        fOut = new FileOutputStream(f);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
    try {
        fOut.flush();
        fOut.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void saveMyBitmap(String bitName, Bitmap mBitmap) throws IOException {
    String myJpgPath = Environment.getExternalStorageDirectory() + "/pepper/" + "1.png";
    File tmp = new File("/sdcard/pepper/");
    if (!tmp.exists()) {
        tmp.mkdir();
    }//  w  w  w.  jav a2 s. co  m
    File f = new File(myJpgPath);
    f.createNewFile();
    FileOutputStream fOut = null;
    try {
        fOut = new FileOutputStream(f);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
    try {
        fOut.flush();
        fOut.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}