Android examples for Hardware:SD Card
get File Storage Directory
//package com.java2s; import java.io.File; import android.content.Context; import android.os.Environment; import android.util.Log; public class Main { private static String LOGTAG = "CameraUtils"; public static File getFileStorageDir(Context context, String name) { String state = Environment.getExternalStorageState(); File file = null;//from www . ja v a 2 s . c om if (Environment.MEDIA_MOUNTED.equals(state)) { file = new File(Environment.getExternalStorageDirectory() + "/layout", name); if ((!file.mkdirs()) && (!file.isDirectory())) { Log.v(LOGTAG, "Directory Creation Failed"); return null; } Log.v(LOGTAG, "Directory Created = " + file.getAbsolutePath()); } else { Log.v(LOGTAG, "External Storage Not Mounted! Problem!!!"); } return file; } }