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
  • 30,160
  • 14
  • 104
  • 106
ASLAM C A
  • 9
  • 1

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,358
  • 1
  • 5
  • 15