Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class BorumJotHomeOptionsMenu {
/**
* Starts the corresponding activity based on which menu item was selected;
* overrides pending transition
* @param item The menu item object
* @return true if a valid option was selected, false (the super method) otherwise
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.options_btn:
startActivity(new Intent(this, OptionsActivity.class));
break;
case R.id.helpandfdbck_btn:
startActivity(new Intent(this, HelpAndFeedbackActivity.class));
break;
case R.id.privacypolicy_btn:
startActivity(new Intent(this, PrivacyPolicyActivity.class));
break;
default:
return super.onOptionsItemSelected(item);
}
// Animate the activity switch so that it slides the home activity out to the left and slides in the new OptionsItemActivity
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment