我得到這個錯誤,當應用程序崩潰我不明白這個錯誤這個錯誤說什麼。 這裏我把我的郵件崩潰日誌報告。下面檢查我所以下方法用於打開和關閉數據庫,我有定義2954行錯誤Sqlite數據庫Pragma異常?
private void Open_Database()
{
//this is 2954 line
mDB_Helper = new DB_Helper(this);
mSQLiteDatabase = mDB_Helper.getWritableDatabase();
}
/* Closing DB */
private void Close_Database()
{
if (mSQLiteDatabase != null && mDB_Helper != null)
{
mSQLiteDatabase.close();
mDB_Helper.close();
}
}
public void deletedata()
{
deleteplaylist.clear();
Open_Database();
deleteplaylist=new ArrayList<HashMap<String,String>>();
deleteplaylist=mDB_Helper.DeleteRecordDetail(mSQLiteDatabase, DB_Constant.TABLE.MYFILES,DB_Constant.MYFILES.USERID, sid);
Close_Database();
for(int m=0;m<deleteplaylist.size();m++)
{
String getid=deleteplaylist.get(m).get(DB_Constant.MYFILES.FILE_ID).toString();
String getpath=deleteplaylist.get(m).get(DB_Constant.MYFILES.FILE_PATH).toString();
Open_Database();
DB_Helper.DeleteData(mSQLiteDatabase, DB_Constant.TABLE.MYFILES,DB_Constant.MYFILES.USERID, sid,DB_Constant.MYFILES.FILE_ID,getid);
File file = new File(getpath);
boolean deleted = file.delete();
Close_Database();
}
}
。
2014-11-08-19-56-30
Yoddle
Error Report collected on : Sat Nov 08 19:56:30 GMT+08:00 2014
Informations :
Locale: en_US
Version: 1.0
Package: com.peak.media
Phone Model: NEO-X8-H
Android Version: 4.4.2
Board: NEO-X8
Brand: MINIX
Device: NEO-X8
Host: user-desktop
ID: KOT49H
Model: NEO-X8-H
Product: k200
Type: user
Total Internal memory: 13396525056
Available Internal memory: 11685687296
Stack:
android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file (code 14): , while compiling: PRAGMA journal_mode
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:894)
at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:639)
at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:323)
at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:297)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:196)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:464)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:186)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:178)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:698)
at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:976)
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:256)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
at com.peak.media.HomeActivityNewViewPager.Open_Database(HomeActivityNewViewPager.java:2954)
at com.peak.media.HomeActivityNewViewPager.deletedata(HomeActivityNewViewPager.java:3130)
at com.peak.media.HomeActivityNewViewPager$4.run(HomeActivityNewViewPager.java:800)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603)
at dalvik.system.NativeStart.main(Native Method)
**** End of current Report ***
嘗試寫'Open_Database()的UI層關閉數據庫; '和'Close_Database();'外部循環。 – 2014-11-08 12:33:07