Java tutorial
//package com.java2s; import android.content.Context; import java.io.File; public class Main { public static File getFileDirectory(Context context) { File appCacheDir = null; if (appCacheDir == null) { appCacheDir = context.getFilesDir(); } if (appCacheDir == null) { String cacheDirPath = "/data/data/" + context.getPackageName() + "/files/"; appCacheDir = new File(cacheDirPath); } return appCacheDir; } }