List of usage examples for android.database.sqlite SQLiteDatabase isDbLockedByOtherThreads
@Deprecated public boolean isDbLockedByOtherThreads()
From source file:org.thomnichols.android.gmarks.WebViewCookiesDB.java
protected SQLiteDatabase openDatabase(final int mode) { File dbPath = ctx.getDatabasePath(DATABASE); if (!dbPath.exists()) return null; try {/*from w w w. j a v a 2s. c om*/ SQLiteDatabase db = SQLiteDatabase.openDatabase(dbPath.getPath(), null, mode); while (db.isDbLockedByOtherThreads()) { Log.w(TAG, "Waiting for other thread to flush DB"); try { Thread.sleep(200); } catch (InterruptedException ex) { } } return db; } catch (SQLiteException ex) { Log.w(TAG, "Error opening database", ex); return null; } }