Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Starting the App Adding the Sign Up Screen

TZECHUNG KAO
TZECHUNG KAO
11,238 Points

NullPoniterException using fragment_sign_up.xml

I have to use fragment to create new signup activity with the latest Eclipse IDE. I was using fragment_sign_up.xml instead of activity_sign_up.xml. I tried to add codes for mSignUpTextView.setOnClickListener in On_Create method, I got NullPointerException error on running.

3 Answers

Eric De Wildt
PLUS
Eric De Wildt
Courses Plus Student 13,077 Points

The null pointer error report should tell you what line the problem code is on. This is a fine place to start looking for the problem.

TZECHUNG KAO
TZECHUNG KAO
11,238 Points

Thanks. I found the line within LoginActivity.java. The object mSignUpTextView was not created on the fragment_sign_up.xml layout when it is called within LoginActivity .java. The lesson did not tell us how to go around this problem using fragment layout instead not using fragment layout in building a SelDestructing Meesage Android App. I was forced to use fragment layout for the latest Android plug in for Eclipse.

TZECHUNG KAO: Can you tell me how you resolved the error? The entire code