@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(); }
private void showDialog(String title, int requestType) { final AlertController.AlertParams p = mAlertParams; p.mTitle = title; if (DEBUG) Log.i(TAG, "showDialog() Request type: " + mRequestType + " this: " + this); switch (requestType) { case BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION: p.mView = createConnectionDialogView(); break; case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS: p.mView = createPhonebookDialogView(); break; case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS: p.mView = createMapDialogView(); break; case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS: p.mView = createSapDialogView(); break; } p.mPositiveButtonText = getString(R.string.yes); p.mPositiveButtonListener = this; p.mNegativeButtonText = getString(R.string.no); p.mNegativeButtonListener = this; mOkButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE); setupAlert(); }