Last active
August 29, 2015 14:07
-
-
Save operando/d638be9f1c05a1455881 to your computer and use it in GitHub Desktop.
【Android】特定のDatabaseファイルを簡単に削除する ref: http://qiita.com/operandoOS/items/8a2ddb21ba868fb816f2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// context=Context helper=SQLiteOpenHelper | |
context.deleteDatabase(helper.getDatabaseName()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean deleteDatabase(String name) { | |
try { | |
File f = validateFilePath(name, false); // DatabaseファイルのObjectを生成 | |
return f.delete(); | |
} catch (Exception e) { | |
} | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// context=Context helper=SQLiteOpenHelper | |
SQLiteDatabase.deleteDatabase(context.getDatabasePath(helper.getDatabaseName())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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