0
我已經存儲了我的價值在數據庫中followes:整數字符串從數據庫
"CREATE TABLE " +
ABezoeAdapter.databasetabel + "(" +
ABezoeAdapter.recordnummer + " INTEGER, " +
ABezoeAdapter.bezoekrapportnummer + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
ABezoeAdapter.bezoekrapportdatum + " DATETIME NOT NULL, " +
ABezoeAdapter.herstellingsoort + " VARCHAR(1) NOT NULL, " +
,但是這給了我的問題如下閱讀常規
Cursor c = onzedatabase.query(databasetabel, allekolommen, bezoekrapportnummer + "=?", new String[] {bezoeknummer}, null, null, null);
int i = 0;
String data[] = new String[30];
data = null;
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
data[i] = c.getString(i);
Log.i("abezoeadapter gegevenslezenvanbezoeknummer", "bezoeknummer = " + data[2]);
}
出的logcat我覺得我得到因爲我的值存儲爲整數,字符串,一個問題...
的logcat:
03-24 18:36:06.321: E/AndroidRuntime(785): FATAL EXCEPTION: main
03-24 18:36:06.321: E/AndroidRuntime(785): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.deceunincktechniekers/com.example.deceunincktechniekers.bezoekrapporten}: java.lang.NullPointerException
03-24 18:36:06.321: E/AndroidRuntime(785): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-24 18:36:06.321: E/AndroidRuntime(785): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-24 18:36:06.321: E/AndroidRuntime(785): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-24 18:36:06.321: E/AndroidRuntime(785): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-24 18:36:06.321: E/AndroidRuntime(785): at android.os.Handler.dispatchMessage(Handler.java:99)
03-24 18:36:06.321: E/AndroidRuntime(785): at android.os.Looper.loop(Looper.java:137)
03-24 18:36:06.321: E/AndroidRuntime(785): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-24 18:36:06.321: E/AndroidRuntime(785): at java.lang.reflect.Method.invokeNative(Native Method)
03-24 18:36:06.321: E/AndroidRuntime(785): at java.lang.reflect.Method.invoke(Method.java:511)
03-24 18:36:06.321: E/AndroidRuntime(785): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-24 18:36:06.321: E/AndroidRuntime(785): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-24 18:36:06.321: E/AndroidRuntime(785): at dalvik.system.NativeStart.main(Native Method)
03-24 18:36:06.321: E/AndroidRuntime(785): Caused by: java.lang.NullPointerException
03-24 18:36:06.321: E/AndroidRuntime(785): at com.example.deceunincktechniekers.ABezoeAdapter.gegevenslezenvanbezoeknummer(ABezoeAdapter.java:480)
03-24 18:36:06.321: E/AndroidRuntime(785): at com.example.deceunincktechniekers.bezoekrapporten.opslaan(bezoekrapporten.java:784)
什麼可以爲我不同類型的值的解決方案 互聯網搜索didnt幫了我至今
在此先感謝