Skip to content Skip to sidebar Skip to footer

I Can't Figure Out What's Wrong With My Nullpointerexception Or Why It Even Exists

What are they? My application keeps crashing whenever I try to pass an object over to my database helper. The variable name is 'e'. I've had the data in the object display in a toa

Solution 1:

If you look towards the bottom of your console output, the stack contains the line number where the NullPointerException occurs:

...
12-0816:29:31.965: E/AndroidRuntime(7049): Caused by: java.lang.NullPointerException
12-0816:29:31.965: E/AndroidRuntime(7049):     at com.typhoon2099.mediacatalogue.MainActivity.onActivityResult(MainActivity.java:193)
12-0816:29:31.965: E/AndroidRuntime(7049):     at android.app.Activity.dispatchActivityResult(Activity.java:4010)
12-0816:29:31.965: E/AndroidRuntime(7049):     at android.app.ActivityGroup.dispatchActivityResult(ActivityGroup.java:123)
...

As you can see above, on line 193 of the MainActivity class, in the onActivityResult() method, you're calling a method on a variable that is null. Since we can't see the line numbers for the code posted, you'll have to venture to this point in your code and determine which variable(s) can be/are null at this point.

Post a Comment for "I Can't Figure Out What's Wrong With My Nullpointerexception Or Why It Even Exists"