在beginnig所有的工作確定,但我已經通過命令刪除數據庫後:的Android的SQLite得到數據庫
this.deleteDatabase("databasename");
,然後我的命令:
databasehelper.getWritableDatabase();
開始扔產生的異常
10-28 23:39:29.190: D/AndroidRuntime(15363): Shutting down VM
10-28 23:39:29.190: W/dalvikvm(15363): threadid=1: thread exiting with uncaught exception (group=0x40b5b300)
10-28 23:39:29.190: E/AndroidRuntime(15363): FATAL EXCEPTION: main
10-28 23:39:29.190: E/AndroidRuntime(15363): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.package/com.package.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=50; index=50
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.os.Handler.dispatchMessage(Handler.java:99)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.os.Looper.loop(Looper.java:137)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-28 23:39:29.190: E/AndroidRuntime(15363): at java.lang.reflect.Method.invokeNative(Native Method)
10-28 23:39:29.190: E/AndroidRuntime(15363): at java.lang.reflect.Method.invoke(Method.java:511)
10-28 23:39:29.190: E/AndroidRuntime(15363): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-28 23:39:29.190: E/AndroidRuntime(15363): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-28 23:39:29.190: E/AndroidRuntime(15363): at dalvik.system.NativeStart.main(Native Method)
10-28 23:39:29.190: E/AndroidRuntime(15363): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=50; index=50
10-28 23:39:29.190: E/AndroidRuntime(15363): at com.package.DBHelper.onCreate(DBHelper.java:41)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
10-28 23:39:29.190: E/AndroidRuntime(15363): at com.package.MainActivity.onCreate(MainActivity.java:28)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.Activity.performCreate(Activity.java:5008)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
10-28 23:39:29.190: E/AndroidRuntime(15363): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
10-28 23:39:29.190: E/AndroidRuntime(15363): ... 11 more
現在我該怎麼辦?
PS:databasehelper.getDatabaseName(); - 作品 –
Post'com.package.DBHelper.onCreate()' – Raffaele