List of usage examples for android.content Context getFilesDir
public abstract File getFilesDir();
From source file:de.geeksfactory.opacclient.webservice.LibraryConfigUpdateService.java
public static void clearConfigurationUpdates(Context context) { File filesDir = new File(context.getFilesDir(), LIBRARIES_DIR); filesDir.mkdirs();//from ww w . j av a2 s. c o m File[] files = filesDir.listFiles(); for (File file : files) { file.delete(); } PreferenceDataSource prefs = new PreferenceDataSource(context); prefs.clearLastLibraryConfigUpdate(); }
From source file:Main.java
/** * clean databases(/data/data/com.xxx.xxx/databases) * * @param context//from ww w . ja v a 2 s . co m */ public static void cleanDatabases(Context context) { deleteFilesInDirectory(new File(context.getFilesDir().getPath() + context.getPackageName() + "/databases")); }
From source file:Main.java
public static String storageDir(Context context) { if (useExternalStorage) { return extStorageDir(context); }//w ww.j a v a2 s . c o m File mediaStorageDir = context.getFilesDir(); return mediaStorageDir.getPath() + File.separator; }
From source file:Main.java
static File getDir(final Context c) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return c.getNoBackupFilesDir(); else//from w ww . java 2 s.c om return c.getFilesDir(); }
From source file:com.truebanana.data.SecureDataFile.java
public static SecureDataFile getDataFile(Context context, String fileName, String password) { return loadFromFile(new File(context.getFilesDir().getPath(), fileName), password); }
From source file:Main.java
/** * clean SharedPreference(/data/data/com.xxx.xxx/shared_prefs) * * @param context/* w ww. jav a2 s. c om*/ */ public static void cleanSharedPreferences(Context context) { deleteFilesInDirectory( new File(context.getFilesDir().getPath() + context.getPackageName() + "/shared_prefs")); }
From source file:Main.java
static public boolean copyAllAssertToCacheFolder(Context c) throws IOException { String[] files = c.getAssets().list("Devices"); String filefolder = c.getFilesDir().toString(); File devicefile = new File(filefolder + "/Devices/"); devicefile.mkdirs();/*from w w w . ja va 2s . c o m*/ for (int i = 0; i < files.length; i++) { File devfile = new File(filefolder + "/Devices/" + files[i]); if (!devfile.exists()) { copyFileTo(c, "Devices/" + files[i], filefolder + "/Devices/" + files[i]); } } String[] filestr = devicefile.list(); for (int i = 0; i < filestr.length; i++) { Log.i("file", filestr[i]); } return true; }
From source file:Main.java
public static String getBaseSavePath(Context context) { String baseSavePath;/* w w w . ja v a2s .co m*/ if (isSDCardEnable()) { baseSavePath = getSDCardPath_M1(); } else { baseSavePath = context.getFilesDir().getAbsolutePath(); } return baseSavePath; }
From source file:hochschuledarmstadt.photostream_tools.ImageCacher.java
static void deleteAllCachedImages(Context context) { File file = context.getFilesDir(); internalDeleteAllCachedImages(file); if (isExternalStorageAccessible()) { File pictureDirectory = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES); internalDeleteAllCachedImages(pictureDirectory); }//from w w w . j a va 2 s .c o m }
From source file:com.commonsware.android.qrck.SyncService.java
static boolean iCanHasData(Context ctxt) { File json = new File(ctxt.getFilesDir(), SYNC_LOCAL_FILE); return (json.exists()); }