0

I am a beginner in android studio. I want to know the code to go to the next activity when I press a button. Could you please show me an example?

vovahost
  • 34,185
  • 17
  • 113
  • 116
ASLAM C A
  • 19
  • 2

1 Answers1

1

Basic code would be:

button = (Button) findViewById(R.id.button);
      button.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
            Intent intent = new Intent(this, NewActivity.class);
            startActivity(intent);
         }
      });
fatalcoder524
  • 1,428
  • 1
  • 7
  • 16