iliqn peev
iliqn peev

Reputation: 1

Problems with intent in second activity

I am new in the android dev and java My idea is to make BMI that will have history. So I am at the point where I struggle with the intent for the second activity.

Button button = findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            openActivity2();
        }
    });
}

private void openActivity2() {
    Intent intent = new intent(this, Activity2.class);
    startActivity(intent);
}

I am getting:

can not resolve symbol intent

Upvotes: 0

Views: 74

Answers (1)

waseem akram
waseem akram

Reputation: 66

'i' should capital when you create new Intent() object The openActivity2() should look like this

        private void openActivity2() {
            Intent intent = new Intent(this, Activity2.class);
            startActivity(intent);
          }

Upvotes: 1

Related Questions