本文整理汇总了Java中android.database.sqlite.SQLiteDatabase.deleteDatabase方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteDatabase.deleteDatabase方法的具体用法?Java SQLiteDatabase.deleteDatabase怎么用?Java SQLiteDatabase.deleteDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.database.sqlite.SQLiteDatabase
的用法示例。
在下文中一共展示了SQLiteDatabase.deleteDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteDatabase
import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
@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.");
}
}
示例2: deleteDatabase
import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
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;
}
示例3: after
import android.database.sqlite.SQLiteDatabase; //导入方法依赖的package包/类
@After
public void after() {
Context context = InstrumentationRegistry.getTargetContext();
String path = context.getDatabasePath(PodcastsUtils.PODCASTS_DATABASE_NAME).getPath();
SQLiteDatabase.deleteDatabase(new File(path));
}