1 вариант:
@Override
protected void onCreate(Bundle savedInstanceState) {
...
Button firstButton = (Button) findViewById(R.id.firstButton);
firstButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Context context = view.getContext();
Intent intent = new Intent(context, secondActivity.class);
context.startActivity(intent);
}
});
...
}
2 вариант:
public void buttonClick(View view){
Intent intent = new Intent(this, secondActivity.class);
startActivity(intent);
}