Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Joseph LaGuidice
3,966 PointsSignUpActivity crashing Ribbit application
Whats up guys, it seems I'm having a problem with my SignUpActivity class. I compared my class code with the code provided in the file download, and they're identical (with exception of a few string resource names). My logcat is telling me that I have a null pointer exception in my on click listener, specifically line 41. This is the
String username = mUsername.getText().toString();
The rest of the error code is as follows:
Process: com.example.nicholas.ribbit, PID: 1596 java.lang.NullPointerException at com.example.nicholas.ribbit.SignUpActivity$1.onClick(SignUpActivity.java:41) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method)
I've been trying to figure this out for the past few hours to no avail, and since I'm up to relating users via parse, I can't really ignore this any longer. Any help would be greatly appreciated
1 Answer
Austin Goodrich
5,221 PointsI had a similar error and I fixed this by reviewing the ID of the onClickListener
mSignUpButton = (Button)findViewById(R.id.CHECK HERE );
Joseph LaGuidice
3,966 PointsJoseph LaGuidice
3,966 PointsThe user name id was wrong -_- Thanks for the help!