In my app, there is a registration button which is supposed to open an activity named "registrationActivity" I tried this:
In XML file:
<Button
android:id="@+id/btnRegister"
android:onClick="startRegister"
/>
In Java file:
public void startRegister(View view)
{
Intent intent = new Intent(LoginActivity.this, RegistrationActivity.class);
startActivity(intent);
}
but every time I click the register button, the app keeps stopping.
Edit 1: error from logcat:
Runtime: FATAL EXCEPTION: main Process: com.test.stork, PID: 5152
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.test.stork/com.test.stork.RegistrationActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference
Edit 2: I found the problem in the registrationActivity itself and now it works. Thanks so much everyone.