Java Code Examples for android.database.sqlite.SQLiteDatabase.deleteDatabase()

The following are Jave code examples for showing how to use deleteDatabase() of the android.database.sqlite.SQLiteDatabase class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: q-mail   File: LockableDatabase.java   View Source Code Vote up 5 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void deleteDatabase(File database) {
    boolean deleted;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        deleted = SQLiteDatabase.deleteDatabase(database);
    } else {
        deleted = database.delete();
        deleted |= new File(database.getPath() + "-journal").delete();
    }
    if (!deleted) {
        Timber.i("LockableDatabase: deleteDatabase(): No files deleted.");
    }
}
 
Example 2
Project: TimeTrix   File: DatabaseAdapter.java   View Source Code Vote up 5 votes
public Boolean deleteDatabase() {
    SQLiteDatabase db = mDatabaseHelper.getWritableDatabase ();
    Boolean result = db.delete (DatabaseHelper.TABLE_NAME, null,
            null) != 0;
    db.getPath ();
    //Toast.makeText (mContext, "path = "+db.getPath (), Toast.LENGTH_SHORT).show ();
    //SQLiteDatabase.deleteDatabase (db.getPath ());
    File fileDataBase = new File (db.getPath ());
    SQLiteDatabase.deleteDatabase (fileDataBase);
    db.close ();
    return result;
}
 
Example 3
Project: lighthouse   File: PodcastsUtilsTest.java   View Source Code Vote up 4 votes
@After
public void after() {
    Context context = InstrumentationRegistry.getTargetContext();
    String path = context.getDatabasePath(PodcastsUtils.PODCASTS_DATABASE_NAME).getPath();
    SQLiteDatabase.deleteDatabase(new File(path));
}