// Button1
final Button btn1 = (Button) findViewById(R.id.button1);
// Perform action on click
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Back to Form 1
Intent newActivity = new Intent(ActivityForm3.this,MainActivity.class);
startActivity(newActivity);
}
});