我不知道我的代码有什么问题。我要做的是将用户输入的信息保存在数据库中。请帮我。
这是传递用户输入的所有信息的代码。这是在我的 SignupActivity 中。
databaseAdapter.saveUserInfo(Lastname,Firstname,MiddleInitial,Username, Password);
现在,这是我的 DatabaseAdapter 中要传递所有信息的代码。
public long saveUserInfo(String Lastname, String Firstname,String MiddleInitial,String Username,String Password)
{
ContentValues contentValues = new ContentValues();
contentValues.put(Constants.DATABASE_COLUMN_FIRSTNAME, Firstname);
contentValues.put(Constants.DATABASE_COLUMN_LASTNAME, Lastname);
contentValues.put(Constants.DATABASE_COLUMN_MI, MiddleInitial);
contentValues.put(Constants.DATABASE_COLUMN_USERNAME, Username);
contentValues.put(Constants.DATABASE_COLUMN_PASSWORD, Password);
return dbSqlite.insert(Constants.DATABASE_TABLE_USER_NAME_WITH_USERNAME_PASSWORD, null, contentValues);
}
我错过了什么吗?这是我的 logcat 中的错误
05-23 16:37:15.080: W/dalvikvm(18203): threadid=1: thread exiting with uncaught exception (group=0x402ac760)
05-23 16:37:15.085: E/AndroidRuntime(18203): FATAL EXCEPTION: main
05-23 16:37:15.085: E/AndroidRuntime(18203): java.lang.NullPointerException
05-23 16:37:15.085: E/AndroidRuntime(18203): at com.example.customercare.SignUpActivity$1.onClick(SignUpActivity.java:65)
05-23 16:37:15.085: E/AndroidRuntime(18203): at android.view.View.performClick(View.java:3131)
05-23 16:37:15.085: E/AndroidRuntime(18203): at android.view.View$PerformClick.run(View.java:12035)
05-23 16:37:15.085: E/AndroidRuntime(18203): at android.os.Handler.handleCallback(Handler.java:587)
05-23 16:37:15.085: E/AndroidRuntime(18203): at android.os.Handler.dispatchMessage(Handler.java:92)
05-23 16:37:15.085: E/AndroidRuntime(18203): at android.os.Looper.loop(Looper.java:132)
05-23 16:37:15.085: E/AndroidRuntime(18203): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-23 16:37:15.085: E/AndroidRuntime(18203): at java.lang.reflect.Method.invokeNative(Native Method)
05-23 16:37:15.085: E/AndroidRuntime(18203): at java.lang.reflect.Method.invoke(Method.java:491)
05-23 16:37:15.085: E/AndroidRuntime(18203): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
05-23 16:37:15.085: E/AndroidRuntime(18203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
05-23 16:37:15.085: E/AndroidRuntime(18203): at dalvik.system.NativeStart.main(Native Method)