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

Android

Null Pointer Exception

Hi Guys I am Getting a Null Pointer Exception on The mSignUpTextView.setOnClickListener(new View.OnClickListener() { And The Full Code is JAVA `` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login);

    mSignUpTextView = (TextView) findViewById(R.id.signUpText);
    mSignUpTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
    Intent intent = new Intent(LoginActivity.this, SignUpActivity.class);
    startActivity(intent);
}

}); } ``

Hello,

Could you post the full java file and the layout xml file so that we can help you find where the issue is starting from?

1 Answer

without full code and log we can only say check your class names if they are correct then check your imports and if they are correct to rebuild your project.

if anyone of these don't make code work right post your log and full code please.