Skip to content

Instantly share code, notes, and snippets.

@ckashby
Created August 3, 2014 22:41
Show Gist options
  • Save ckashby/78fb434fed7cd78953ab to your computer and use it in GitHub Desktop.
Save ckashby/78fb434fed7cd78953ab to your computer and use it in GitHub Desktop.
Android Switch / Case ...
@Override // this does not override a super class method. Whats up?
public void onClick(View view) {
switch (view.getId()) {
case R.id.taskButton: {
Intent intent = new Intent(this, TasksActivity.class);
startActivity(intent);
}
break;
case R.id.phoneButton: {
Intent intent = new Intent(this, PhoneActivity.class);
startActivity(intent);
}
break;
case R.id.musicButton: {
Intent intent = new Intent(this, MusicActivity.class);
startActivity(intent);
}
break;
case R.id.calendarButton: {
Intent intent = new Intent(this, CalendarActivity.class);
startActivity(intent);
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment