Skip to content

Instantly share code, notes, and snippets.

@operando
Last active August 29, 2015 14:07
Show Gist options
  • Save operando/d638be9f1c05a1455881 to your computer and use it in GitHub Desktop.
Save operando/d638be9f1c05a1455881 to your computer and use it in GitHub Desktop.
【Android】特定のDatabaseファイルを簡単に削除する ref: http://qiita.com/operandoOS/items/8a2ddb21ba868fb816f2
// context=Context helper=SQLiteOpenHelper
context.deleteDatabase(helper.getDatabaseName());
@Override
public boolean deleteDatabase(String name) {
try {
File f = validateFilePath(name, false); // DatabaseファイルのObjectを生成
return f.delete();
} catch (Exception e) {
}
return false;
}
// context=Context helper=SQLiteOpenHelper
SQLiteDatabase.deleteDatabase(context.getDatabasePath(helper.getDatabaseName()));
@Override
public boolean deleteDatabase(String name) {
try {
File f = validateFilePath(name, false);
return SQLiteDatabase.deleteDatabase(f);
} catch (Exception e) {
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment