package tdc.edu.vn.baitap2_tranngocnam; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button btnBai2, btnBai6; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setControl(); setEvent(); } private void setEvent() { btnBai2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, bai_2.class); startActivity(intent); } }); btnBai6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, bai_6.class); startActivity(intent); } }); } private void setControl() { btnBai2 = findViewById(R.id.btnBai2); btnBai6 = findViewById(R.id.btnBai6); } }