Skip to content

Instantly share code, notes, and snippets.

@Aiur3908
Last active November 24, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aiur3908/00fa2f3d2fc6c37784fc to your computer and use it in GitHub Desktop.
Save Aiur3908/00fa2f3d2fc6c37784fc to your computer and use it in GitHub Desktop.
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