-1

I'm developing a simple smart lock app with google sign in with firebase. After login to authentication activity, I tried to change activity to my main activity through "change to main activity" button. But it suddenly crash. Is there any solution for this problem?

In java:

    public void openMainActivity(View view) {
        Intent intent;
        intent = new Intent(this, MainActivity.class);
        startActivity(intent);
    }

In layout:

    <Button
        android:id="@+id/btn_change"
        android:text="Servo Lock"
        android:layout_centerInParent="true"
        android:onClick="openMainActivity"
        android:layout_above="@+id/btn_sign_out"
        android:layout_marginBottom="50dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

I expect that it can change from auth activity to main activity. But the app suddenly crash.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441

1 Answers1

0

Make sure you registered Activity in Manifest file. If again app crash then shares an error log to find the exact problem.

Rana Aamer
  • 21
  • 2
  • I already register both Activity in Manifest file. This is the bug on my phone (I don't use emulator in android studio): https://i.imgur.com/1uNVwJR.jpg – Fakhrul Syazwan Oct 28 '19 at 11:38