2015-10-31 27 views
1

我一直在登錄註冊應用程序,目前正在面臨一些問題。沒有信息存儲在SQLite數據庫

我遇到的問題是沒有數據存儲到我的SQLite數據庫中,即使我能夠輸入信息並單擊「註冊」按鈕。
而且每當我點擊「登錄」按鈕,應用程序將始終顯示「不幸這個應用程序停止」。

有誰知道爲什麼,可以幫忙嗎?
我希望能儘快爲我的最後一年項目提供幫助。

的logcat:

11-01 02:52:06.893 31336-31336/? E/Zygote﹕ MountEmulatedStorage() 
11-01 02:52:06.893 31336-31336/? E/Zygote﹕ v2 
11-01 02:52:06.893 31336-31336/? I/libpersona﹕ KNOX_SDCARD checking this for 10139 
11-01 02:52:06.893 31336-31336/? I/libpersona﹕ KNOX_SDCARD not a persona 
11-01 02:52:06.893 31336-31336/? I/SELinux﹕ Function: selinux_compare_spd_ram, SPD-policy is existed. and_ver=SEPF_GT-I9505_5.0.1 ver=27 
11-01 02:52:06.893 31336-31336/? I/SELinux﹕ Function: selinux_compare_spd_ram , priority [2] , priority version is VE=SEPF_GT-I9505_5.0.1-1_0032 
11-01 02:52:06.903 31336-31336/edu.np.ece.information E/SELinux﹕ [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL 
11-01 02:52:06.903 31336-31336/edu.np.ece.information I/art﹕ Late-enabling -Xcheck:jni 
11-01 02:52:06.933 31336-31343/edu.np.ece.information E/art﹕ Failed writing handshake bytes (-1 of 14): Broken pipe 
11-01 02:52:06.933 31336-31343/edu.np.ece.information I/art﹕ Debugger is no longer active 
11-01 02:52:06.983 31336-31336/edu.np.ece.information D/ResourcesManager﹕ creating new AssetManager and set to /data/app/edu.np.ece.information-1/base.apk 
11-01 02:52:07.203 31336-31336/edu.np.ece.information D/Activity﹕ performCreate Call secproduct feature valuefalse 
11-01 02:52:07.203 31336-31336/edu.np.ece.information D/Activity﹕ performCreate Call debug elastic valuetrue 
11-01 02:52:07.213 31336-31353/edu.np.ece.information D/OpenGLRenderer﹕ Render dirty regions requested: true 
11-01 02:52:07.263 31336-31353/edu.np.ece.information I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: () 
    OpenGL ES Shader Compiler Version: E031.25.03.06 
    Build Date: 01/24/15 Sat 
    Local Branch: AF11_RB1_AU15 
    Remote Branch: 
    Local Patches: 
    Reconstruct Branch: 
11-01 02:52:07.263 31336-31353/edu.np.ece.information I/OpenGLRenderer﹕ Initialized EGL, version 1.4 
11-01 02:52:07.293 31336-31353/edu.np.ece.information D/OpenGLRenderer﹕ Enabling debug mode 0 
11-01 02:52:07.593 31336-31336/edu.np.ece.information I/Timeline﹕ Timeline: Activity_idle id: [email protected] time:4384368 
11-01 02:52:11.237 31336-31336/edu.np.ece.information D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN 
11-01 02:52:14.110 31336-31336/edu.np.ece.information D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN 
11-01 02:52:16.302 31336-31336/edu.np.ece.information D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN 
11-01 02:52:16.372 31336-31336/edu.np.ece.information E/SQLiteLog﹕ (1) no such column: pass 
11-01 02:52:16.372 31336-31336/edu.np.ece.information D/AndroidRuntime﹕ Shutting down VM 
11-01 02:52:16.372 31336-31336/edu.np.ece.information E/AndroidRuntime﹕ FATAL EXCEPTION: main 
    Process: edu.np.ece.information, PID: 31336 
    java.lang.IllegalStateException: Could not execute method of the activity 
      at android.view.View$1.onClick(View.java:4253) 
      at android.view.View.performClick(View.java:5197) 
      at android.view.View$PerformClick.run(View.java:20926) 
      at android.os.Handler.handleCallback(Handler.java:739) 
      at android.os.Handler.dispatchMessage(Handler.java:95) 
      at android.os.Looper.loop(Looper.java:145) 
      at android.app.ActivityThread.main(ActivityThread.java:5942) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 
    Caused by: java.lang.reflect.InvocationTargetException 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at android.view.View$1.onClick(View.java:4248) 
      at android.view.View.performClick(View.java:5197) 
      at android.view.View$PerformClick.run(View.java:20926) 
      at android.os.Handler.handleCallback(Handler.java:739) 
      at android.os.Handler.dispatchMessage(Handler.java:95) 
      at android.os.Looper.loop(Looper.java:145) 
      at android.app.ActivityThread.main(ActivityThread.java:5942) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 
    Caused by: android.database.sqlite.SQLiteException: no such column: pass (code 1): , while compiling: select uname, pass from information 
      at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 
      at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1093) 
      at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:670) 
      at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 
      at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59) 
      at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37) 
      at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) 
      at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1440) 
      at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1379) 
      at edu.np.ece.information.DatabaseHelper.searchPass(DatabaseHelper.java:68) 
      at edu.np.ece.information.MainActivity.onButtonClick(MainActivity.java:38) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at android.view.View$1.onClick(View.java:4248) 
      at android.view.View.performClick(View.java:5197) 
      at android.view.View$PerformClick.run(View.java:20926) 
      at android.os.Handler.handleCallback(Handler.java:739) 
      at android.os.Handler.dispatchMessage(Handler.java:95) 
      at android.os.Looper.loop(Looper.java:145) 
      at android.app.ActivityThread.main(ActivityThread.java:5942) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:372) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 

這裏是項目文件夾鏈接: https://drive.google.com/file/d/0B5SCHjXnxzeOZ1ZuRWVqa2pnYm8/view?usp=sharing

+0

看起來你已經在**之後添加了「pass **」列**你運行了應用程序一次。 –

回答

-1

在你Information.java文件中,emergencycontactnumber setter方法不正確,

public void setEmergencycontactnumber (String emergencycontactnumber){ 
    this.name = emergencycontactnumber; 
} 

雖然它應該是

public void setEmergencycontactnumber (String emergencycontactnumber){ 
    this.emergencycontactnumber= emergencycontactnumber; 
} 

這裏發生什麼事是,emergencycontactnumber總是null因爲你不設置它,所以,當插入數據的sqlite拋出錯誤,因爲在你創建表的查詢時,您已指定emergencycontactnumber text not null,結果到錯誤,您的數據永遠堅持。

+0

非常感謝,我改變了它,並且應用程序可以正常工作。上帝保佑你是一個偉大的幫助。祝你有個美好的一天! :) – P714

+0

任何理由降低投票答案? –

+0

已接受。我投票答案,但不知道爲什麼-1,可能有人投票。 – P714