public class MainActivity extends Activity implements OnClickListener {
private Button bt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bt = (Button) this.findViewById(R.id.bt);
bt.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// 注意,Activity一定要在manifest.xml中配置
// 方式一:显式意图
// Intent intent = new Intent();
// intent.setClassName(getPackageName(), getPackageName()+".SecondActivity");
// 方式二:显式意图:如果另外一个意图和当前在同一个包下的简洁方式
Intent intent = new Intent(this, SecondActivity.class);
this.startActivity(intent);
}
}