Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.os.Environment; import java.io.File; public class Main { public static File getWritableFileDir(Context context) { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { File file = context.getExternalFilesDir(null); if (file == null) { file = context.getFilesDir(); } return file; } else { return context.getFilesDir(); } } }