Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import android.annotation.SuppressLint; import android.content.Context; public class Main { @SuppressLint("SdCardPath") 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; } }