[Solved] Click on button in MainActivity and go to screen on MainActivity2 [closed]
In your onCreate method, you should do something like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(Bundle savedInstanceState); setContentView(R.layout.activity_main); Button btn = findViewById(R.id.your_button_id); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, MainActivity2.class)); } } } The your_button_id is the ID of the button in your MainActivity and the code above tells the … Read more