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?
Asked
Active
Viewed 45 times
1 Answers
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