コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set up the "dialog"
    final Intent intent = getIntent();
    final AlertController.AlertParams p = mAlertParams;
    Context context = getApplicationContext();
    p.mTitle = intent.getStringExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_TITLE);
    p.mMessage = intent.getStringExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_MESSAGE);
    p.mPositiveButtonText = String.format(context.getString(R.string.gpsVerifYes));
    p.mPositiveButtonListener = this;
    p.mNegativeButtonText = String.format(context.getString(R.string.gpsVerifNo));
    p.mNegativeButtonListener = this;

    notificationId = intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_NOTIF_ID, -1);
    timeout =
        intent.getIntExtra(GpsNetInitiatedHandler.NI_INTENT_KEY_TIMEOUT, default_response_timeout);
    default_response =
        intent.getIntExtra(
            GpsNetInitiatedHandler.NI_INTENT_KEY_DEFAULT_RESPONSE,
            GpsNetInitiatedHandler.GPS_NI_RESPONSE_ACCEPT);
    if (DEBUG)
      Log.d(
          TAG,
          "onCreate() : notificationId: "
              + notificationId
              + " timeout: "
              + timeout
              + " default_response:"
              + default_response);

    mHandler.sendMessageDelayed(mHandler.obtainMessage(GPS_NO_RESPONSE_TIME_OUT), (timeout * 1000));
    setupAlert();
  }