List of usage examples for android.content Context getDatabasePath
public abstract File getDatabasePath(String name);
From source file:Main.java
public static File GetDataBaseFile(Context paramContext) { return paramContext.getDatabasePath("dataTer"); }
From source file:Main.java
public static File getDatabasePath(Context paramContext) { return paramContext.getDatabasePath(getDatabaseName(1)); }
From source file:Main.java
private static boolean checkIfDatabaseExists(Context context, String legacyTable) { return context.getDatabasePath(legacyTable).exists(); }
From source file:Main.java
public static boolean x(Context context, String dbName) { File dbFile = context.getDatabasePath(dbName); return dbFile.exists(); }
From source file:Main.java
/** * check SQLite DB status/* w ww . j a va2 s . c o m*/ * @param context Context * @param dbName database name * @return true == exist, false == not exist */ public static boolean doesDatabaseExist(Context context, String dbName) { File dbFile = context.getDatabasePath(dbName); return dbFile.exists(); }
From source file:Main.java
/** * Return the directory for a given attachment. This should be used by any code that is * going to *write* attachments./*from w w w . ja va 2 s .co m*/ * * This does not create or write the directory. It simply builds the pathname that should be * used. */ public static File getAttachmentDirectory(Context context, long accountId) { return context.getDatabasePath(accountId + ".db_att"); }
From source file:Main.java
/** * DB test/*from www. jav a2 s . c o m*/ */ public static void runBackup(Context context) { File file = context.getDatabasePath("PhotoDeskHiddenFolder.db"); int size = (int) file.length(); String path = Environment.getExternalStorageDirectory() + "/PhotoDesk/"; try { byte[] buffer = new byte[size]; InputStream inputStream = new FileInputStream(file); inputStream.read(buffer); inputStream.close(); File outputDBDirectory = new File(path); if (!outputDBDirectory.isDirectory()) outputDBDirectory.mkdir(); path += "test.db"; File outputFile = new File(path); FileOutputStream outputStream = new FileOutputStream(outputFile); outputStream.write(buffer); outputStream.flush(); outputStream.close(); } catch (Exception e) { } }
From source file:com.yattatech.dbtc.util.DbUtil.java
/** * Copies the application database to given folder, it' very useful * for debugging purpose only.//from ww w. j av a 2 s . com * * @param path * */ public static void copyDatabase(String path) { final File folder = new File(path); final Context context = DBTCApplication.sApplicationContext; if (!folder.exists()) { folder.exists(); } for (String database : context.databaseList()) { final File dbFile = context.getDatabasePath(database); InputStream in = null; OutputStream out = null; try { in = new FileInputStream(dbFile); out = new FileOutputStream(new File(folder, database)); IOUtils.copy(in, out); } catch (IOException ioe) { Debug.d(TAG, "Failed:", ioe); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); } } }
From source file:Main.java
/** * Copy database files to the given folder. Useful for debugging. * * @param folder the directory to copy files into *//*from w w w . j av a 2 s.c o m*/ public static void copyDatabases(Context context, String folder) { File folderFile = new File(folder); if (!folderFile.exists()) { folderFile.mkdir(); } for (String db : context.databaseList()) { File dbFile = context.getDatabasePath(db); try { copyFile(dbFile, new File(folderFile.getAbsolutePath() + File.separator + db)); } catch (Exception e) { Log.e("ERROR", "ERROR COPYING DB " + db, e); } } }
From source file:com.seneca.android.senfitbeta.MainActivity.java
private static boolean doesDatabaseExist(Context context, String dbName) { File dbFile = context.getDatabasePath(dbName); return dbFile.exists(); }