telgniw/BukuDroid — Issue #6: db crash while reopen + no friends' stream when execute it at the first time
Author: anfranion
Created: 2012-01-05 10:59:33+00:00
State: open

I got runtime error while I reopened the app after I pressed 'back' or 'home.'
The messages are as follows:
==============================================================
01-05 18:51:57.850: E/AndroidRuntime(28526): FATAL EXCEPTION: main
01-05 18:51:57.850: E/AndroidRuntime(28526): java.lang.RuntimeException: Unable to resume activity {org.csie.mpp.buku/org.csie.mpp.buku.MainActivity}: java.lang.IllegalStateException: database not open
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2124)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2139)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1672)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.os.Looper.loop(Looper.java:130)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread.main(ActivityThread.java:3691)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at java.lang.reflect.Method.invokeNative(Native Method)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at java.lang.reflect.Method.invoke(Method.java:507)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at dalvik.system.NativeStart.main(Native Method)
01-05 18:51:57.850: E/AndroidRuntime(28526): Caused by: java.lang.IllegalStateException: database not open
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1371)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1330)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1412)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at org.csie.mpp.buku.db.Entry$Schema.count(Entry.java:161)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at org.csie.mpp.buku.db.BookEntry.count(BookEntry.java:64)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at org.csie.mpp.buku.view.BookshelfManager.updateView(BookshelfManager.java:196)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at org.csie.mpp.buku.view.ViewManager.updateAll(ViewManager.java:26)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at org.csie.mpp.buku.MainActivity.onResume(MainActivity.java:118)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1153)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.Activity.performResume(Activity.java:3874)
01-05 18:51:57.850: E/AndroidRuntime(28526):	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2114)
01-05 18:51:57.850: E/AndroidRuntime(28526):	... 12 more
==============================================================

Besides, after I cleared my database and execute the app, I logined to Facebook and found no friends' stream.
I guessed it's because friend lists are built after stream is showed.