Monday, 19 August 2013

NullPointerException in android project

NullPointerException in android project

I tried to launch AddEditRecipesActivity.java from RecipesActivity.java.
In RecipesActivity there is a list of data from datatable. By pressing Add
button in RecipesActivity, AddEditRecipesActivity.java is called, where I
insert data in datatable. But when I pressed this button, my application
crashed.
This is LogCat messages.
08-20 04:13:20.315: E/Your TAG,(9425): Your Message
08-20 04:13:20.315: E/Your TAG,(9425): java.lang.RuntimeException: Unable
to instantiate activity
ComponentInfo{com.example.behealthy/com.example.behealthy.AddEditRecipesActivity}:
java.lang.NullPointerException
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.ActivityThread.access$600(ActivityThread.java:140)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.os.Handler.dispatchMessage(Handler.java:99)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.os.Looper.loop(Looper.java:137)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.ActivityThread.main(ActivityThread.java:4898)
08-20 04:13:20.315: E/Your TAG,(9425): at
java.lang.reflect.Method.invokeNative(Native Method)
08-20 04:13:20.315: E/Your TAG,(9425): at
java.lang.reflect.Method.invoke(Method.java:511)
08-20 04:13:20.315: E/Your TAG,(9425): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
08-20 04:13:20.315: E/Your TAG,(9425): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
08-20 04:13:20.315: E/Your TAG,(9425): at
dalvik.system.NativeStart.main(Native Method)
08-20 04:13:20.315: E/Your TAG,(9425): Caused by:
java.lang.NullPointerException
08-20 04:13:20.315: E/Your TAG,(9425): at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:228)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
08-20 04:13:20.315: E/Your TAG,(9425): at
com.example.behealthy.AddEditRecipesActivity.(AddEditRecipesActivity.java:27)
08-20 04:13:20.315: E/Your TAG,(9425): at
java.lang.Class.newInstanceImpl(Native Method)
08-20 04:13:20.315: E/Your TAG,(9425): at
java.lang.Class.newInstance(Class.java:1319)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.Instrumentation.newActivity(Instrumentation.java:1057)
08-20 04:13:20.315: E/Your TAG,(9425): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
08-20 04:13:20.315: E/Your TAG,(9425): ... 11 more
Thanks.

No comments:

Post a Comment