List of usage examples for android.content Context getFilesDir
public abstract File getFilesDir();
From source file:Main.java
public static File getSecurityPath(Context context) { return new File(context.getFilesDir().getPath() + File.separatorChar + "bpsec"); }
From source file:Main.java
public static boolean isFileExist(Context context, String fileName) { File fileDir = context.getFilesDir(); File f = new File(fileDir, fileName); boolean exist = f.exists(); return exist; }
From source file:Main.java
public static void deleteObject(Context context, String fileName) { String filePath = context.getFilesDir().getPath() + "/" + fileName; File file = new File(filePath); if (file.exists()) { file.delete();/* w w w . ja v a2s .co m*/ } }
From source file:Main.java
public static boolean deleteLogs(final Context context) { return new File(context.getFilesDir(), "commands.txt").delete(); }
From source file:Main.java
private static String getFileDir(Context context, String dirName) { File file = context.getFilesDir(); if (null != file) { File temp = new File(file.getPath() + "/" + dirName); if (!temp.exists()) { temp.mkdirs();/* w ww . ja v a 2s . co m*/ } return temp.getPath(); } return null; }
From source file:Main.java
public static List<File> getFiles(Context context, String ext) { File dir = context.getFilesDir(); final List<File> files = new ArrayList<File>(); File[] subFiles = dir.listFiles(); if (subFiles != null) { for (File file : subFiles) { if (file.isFile() && file.getName().endsWith(ext)) { files.add(file);// ww w . jav a 2 s . c o m } } } return files; }
From source file:Main.java
public static String getPrivateFilePath(Context context, String yourAppPath) { String PATH = context.getFilesDir().getAbsolutePath() + yourAppPath; File file = new File(PATH); if (!(file.exists() && file.isDirectory())) { file.mkdirs();/*from w w w.j a v a 2 s .co m*/ } return PATH; }
From source file:Main.java
public static File getDiskCacheFile(Context context, String key) { final String cachePath = context.getFilesDir().getPath(); File cacheDir = new File(cachePath + File.separator + DISK_CACHE_SUBDIR); if (!cacheDir.exists()) { cacheDir.mkdir();/*from w ww. j a v a2 s . c om*/ } return new File(cacheDir + File.separator + key); }
From source file:Main.java
public static String getAppDataFilesDir(Context context) { if (context != null) { return context.getFilesDir().getPath(); }// w w w . j a v a 2s .co m return ""; }
From source file:Main.java
public static boolean isCityExist(Context context, String city) { File file = new File(context.getFilesDir(), DATABASE_NAME); SQLiteDatabase db = context.openOrCreateDatabase(file.getAbsolutePath(), Context.MODE_PRIVATE, null); Cursor cursor = db.rawQuery("select count(1) from " + TABLE_NAME + " where DQXX02=?", new String[] { city }); cursor.moveToNext();//w w w .j a v a2s . co m return cursor.getInt(0) > 0; }