android - Why some users are getting SQLiteException at SQLiteDatabase.dbopen()? -
here exception:
java.lang.runtimeexception: unable start activity componentinfo{spb.bridges/spb.bridges.bridges}: android.database.sqlite.sqliteexception: unable open database file @ android.app.activitythread.performlaunchactivity(activitythread.java:2663) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2679) @ android.app.activitythread.access$2300(activitythread.java:125) @ android.app.activitythread$h.handlemessage(activitythread.java:2033) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:123) @ android.app.activitythread.main(activitythread.java:4627) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:521) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:858) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) @ dalvik.system.nativestart.main(native method) caused by: android.database.sqlite.sqliteexception: unable open database file @ android.database.sqlite.sqlitedatabase.dbopen(native method) @ android.database.sqlite.sqlitedatabase.<init>(sqlitedatabase.java:1921) @ android.database.sqlite.sqlitedatabase.opendatabase(sqlitedatabase.java:883) @ android.database.sqlite.sqlitedatabase.openorcreatedatabase(sqlitedatabase.java:960) @ android.database.sqlite.sqlitedatabase.openorcreatedatabase(sqlitedatabase.java:953) @ android.app.contextimpl.openorcreatedatabase(contextimpl.java:602) @ android.content.contextwrapper.openorcreatedatabase(contextwrapper.java:203) @ android.database.sqlite.sqliteopenhelper.getwritabledatabase(sqliteopenhelper.java:98) @ spb.bridges.dbadapter.open(dbadapter.java:172) @ spb.bridges.bridges.oncreate(bridges.java:90) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1049) @ android.app.activitythread.performlaunchactivity(activitythread.java:2627)
and here code of dbadapter.open
:
public dbadapter open() throws sqlexception { mdbhelper = new databasehelper(mctx); mdb = mdbhelper.getwritabledatabase(); return this; }
bridges.oncreate
:
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.bridges_list); mdbhelper = new dbadapter(this); mdbhelper.open();
it looks context not initialized when open database.
in bridges.oncreate
method, call super.oncreate
? setcontentview
before other operations?
Comments
Post a Comment