Java tutorial
//package com.java2s; //License from project: Open Source License import android.os.Environment; import android.util.Log; import java.io.File; public class Main { public static String getDownloadDir() { String status = Environment.getExternalStorageState(); if (status == null || !status.equals(Environment.MEDIA_MOUNTED)) { return null; } String path = null; // get the sdcard directory File sdFile = Environment.getExternalStorageDirectory(); if (null != sdFile) { path = sdFile.toString(); } else { path = "/sdcard/"; } path += "/download"; File destDir = new File(path); if (!destDir.exists()) { try { if (!destDir.mkdirs()) { Log.e("getDownloadDir", "create folder " + path + " failed"); return null; } } catch (SecurityException e) { Log.e("getDownloadDir", "create folder " + path + " failed: " + e.toString()); return null; } } return path; } }