@SuppressWarnings("deprecation") // TODO: refactor to use DialogFrament
  @Override
  protected Dialog onCreateDialog(int id, Bundle args) {
    switch (id) {
      case DIALOG_ID_INVALID_DEVICE:
        return new AlertDialog.Builder(this)
            .setIcon(R.drawable.quantum_ic_report_problem_grey600_24)
            .setTitle(R.string.error_title)
            .setMessage(R.string.error_invalid_device)
            .setPositiveButton(R.string.ok, null)
            .create();
      default:
        return super.onCreateDialog(id, args);
    }
  }
Called when the activity is first created
java/com/google/android/apps/authenticator/otp/EnterKeyActivity.java