Skip to content

Instantly share code, notes, and snippets.

@YvesBill
Last active December 21, 2015 04:39
Show Gist options
  • Save YvesBill/6251414 to your computer and use it in GitHub Desktop.
Save YvesBill/6251414 to your computer and use it in GitHub Desktop.
...
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.setting:
setting();
return true;
case R.id.about:
about();
return true;
case R.id.credit:
credit();
default:
return super.onOptionsItemSelected(item);
}
}
private void credit() {
Intent credit = new Intent(MainActivity.this, Credit.class);
startActivity(credit);
}
private void about() {
Intent about = new Intent(MainActivity.this, About.class);
startActivity(about);
}
private void setting() {
Intent setting = new Intent(MainActivity.this, Setting.class);
startActivity(setting);
}}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment