The app is basically (as of yet) a login/sign up page I'm having trouble switching activities... the app crashes when I add the setOnClickListener.
class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
configureBtnSignUp();
configureBtnResetPassword();
}
private void configureBtnSignUp(){
Button btnSignUp = (Button) findViewById(R.id.btn_signup);
btnSignUp.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
startActivity(new Intent(LoginActivity.this, SignUpActivity.class));
}
});
}
private void configureBtnResetPassword(){
Button btnResetPassword = (Button) findViewById(R.id.btn_reset_password);
btnResetPassword.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(LoginActivity.this, PwRecoverActivity.class));
}
});
}
}
This is the error code
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at kardacorporation.bandme.LoginActivity.configureBtnSignUp(LoginActivity.java:24)
at kardacorporation.bandme.LoginActivity.onCreate(LoginActivity.java:18)