自定义显示函数
private void showMessage(String message) {
Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
}
- 匿名内部式
Button btn_first = (Button) findViewById(R.id.btn_first);
btn_first.setOnClickListener(new View.OnClickListener