@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
//增加自己的代码......
//Button pButton = (Button) findViewById(R.id.button);
//pButton.setText("OnClick. " + " ....");
GoToMainActivity();
}
});
}
/**
* 进入主界面
*/
private void GoToMainActivity() {
Intent i = new Intent(this,Main2Activity.class);
startActivity(i);
finish();
}
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click //增加自己的代码...... //Button pButton = (Button) findViewById(R.id.button); //pButton.setText("OnClick. " + " ...."); GoToMainActivity(); } }); } /** * 进入主界面 */ private void GoToMainActivity() { Intent i = new Intent(this,Main2Activity.class); startActivity(i); finish(); }