Java tutorial
//package com.java2s; import android.os.Environment; import java.io.File; public class Main { public static final String CARDBOARD_CONFIG_FOLDER = "Cardboard"; public static File getConfigFile(final String filename) { final File configFolder = new File(Environment.getExternalStorageDirectory(), CARDBOARD_CONFIG_FOLDER); if (!configFolder.exists()) { configFolder.mkdirs(); } else if (!configFolder.isDirectory()) { final String value = String.valueOf(String.valueOf(configFolder)); throw new IllegalStateException( new StringBuilder().append("Folder ").append(value).append(" already exists").toString()); } return new File(configFolder, filename); } }