错误


06/07 21:28:46: Launching app
Cold swapped changes.
$ adb shell am start -n "com.example.bz0209.happyidiom/com.example.bz0209.happyidiom.activity.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Waiting for process to come online
Connected to process 4469 on device Nexus_5_API_24 [emulator-5554]
W/gralloc_ranchu: Gralloc pipe failed

                  [ 06-07 13:28:47.320  4469: 4469 D/         ]
                  HostConnection::get() New Host Connection established 0xa7847580, tid 4469
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.bz0209.happyidiom, PID: 4469
                  java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.sqlite.SQLiteDatabase android.content.Context.openOrCreateDatabase(java.lang.String, int, android.database.sqlite.SQLiteDatabase$CursorFactory, android.database.DatabaseErrorHandler)' on a null object reference
                      at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
                      at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
                      at com.example.bz0209.happyidiom.dao.CollectDao.DeleteData(CollectDao.java:73)
                      at com.example.bz0209.happyidiom.adapter.CollectAdapter$1$1.onClick(CollectAdapter.java:99)
                      at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:164)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6077)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Application terminated.




主要问题是没有把上下文传过来,点击删除活动不能在此上下文上进行

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页