Last active
November 24, 2015 14:14
-
-
Save Aiur3908/00fa2f3d2fc6c37784fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
//取得此Button的實體 | |
button = (Button)findViewById(R.id.button); | |
//實做OnClickListener界面 | |
button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
//初始化Intent物件 | |
Intent intent = new Intent(); | |
//從MainActivity 到Main2Activity | |
intent.setClass(MainActivity.this , Main2Activity.class); | |
//開啟Activity | |
startActivity(intent); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment