Java tutorial
//package com.java2s; import android.content.Context; import android.os.Environment; import java.io.File; public class Main { private static final String DOWNLOAD_DIR = "download"; public static final File getDownloadDir(Context context) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return new File(context.getExternalCacheDir(), DOWNLOAD_DIR); } return new File(context.getCacheDir(), DOWNLOAD_DIR); } }