Android Studio Project не открывает новую деятельность - PullRequest
0 голосов
/ 29 апреля 2020

Я пытался открыть новое действие в течение нескольких дней, но при открытии в AVD происходит сбой. Где проблема?

    button = (Button) findViewById(R.id.button);
    button.setOnClickListener(v -> openRegister());

public void openRegister() {
    Intent intent = new Intent(MainActivity.this, Register.class);
    startActivity(intent);
}

1 Ответ

1 голос
/ 29 апреля 2020

Попробуйте

Intent intent = new Intent(this, NewActivity.class);
startActivity(intent);

См. Документы Google по этому вопросу здесь: https://developer.android.com/training/basics/firstapp/starting-activity#BuildIntent

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...