List of usage examples for android.app AlertDialog.Builder setIcon
public void setIcon(Drawable icon)
From source file:com.smc.tw.waltz.MainActivity.java
private void showSignOutDialog() { if (DEBUG)/*from w w w. java2s.co m*/ Log.d(TAG, "showSignOutDialog"); UserManager userManager = MainApplication.getUserManager(); if (!MainApplication.isUserSignedIn()) return; if (userManager == null) return; AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.sure_to_sign_out) + " (" + userManager.getUsername() + ") ?"); builder.setCancelable(false); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { for (int i = 0; i < MainApplication.getWaltzDeviceNumber(); i++) { WaltzDevice device = MainApplication.getWaltzDevice(i); ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } MainApplication.removeAllWaltzDevices(); signOut(); MainApplication.saveDeviceList(); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); builder.create().show(); }
From source file:com.smc.tw.waltz.MainActivity.java
private void showConnectionFailDialog(final WaltzDevice device, int error) { if (DEBUG)//from www.j ava 2 s. c o m Log.d(TAG, "showConnectionFailDialog d:" + device); String name = device.getName(); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.dialog_connection_fail); //builder.setMessage(getString(R.string.dialog_fail_to_connect) + " " + name); switch (error) { case WaltzDevice.ACCESS_CODE_AUTHORITY_ERROR: builder.setMessage(getString(R.string.dialog_fail_to_connect) + " " + name); break; case WaltzDevice.REQUEST_TIMEOUT: builder.setMessage(getString(R.string.dialog_fail_to_connect) + " " + name); break; case WaltzDevice.AM_SERVER_CONNECTION_ERROR: builder.setMessage(name + " " + getString(R.string.cannot_connect) + " " + "AM Server"); break; case WaltzDevice.AM_SERVER_PERMISSION_ERROR: builder.setMessage(getString(R.string.dialog_fail_to_connect) + " " + name + "(Permission)"); break; case WaltzDevice.PORT_BLOCKING_ERROR: builder.setMessage(name + " " + getString(R.string.cannot_reach_am)); break; case WaltzDevice.DNS_RESOLVING_ERROR: builder.setMessage(getString(R.string.cannot_resolve_dns)); break; default: builder.setMessage(getString(R.string.dialog_fail_to_connect) + " " + name); break; } builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { showDeviceList(); } }); builder.create().show(); }
From source file:com.smc.tw.waltz.MainActivity.java
private void showDeleteDeviceDialog(final int index) { if (DEBUG)/*from w w w . ja v a 2 s. c o m*/ Log.d(TAG, "showDeleteDeviceDialog i:" + index); final WaltzDevice device = MainApplication.getWaltzDevice(index); if (MainApplication.isUserSignedIn() && device.isOwnerScope()) { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.device_owner) + " (" + device.getName() + ")."); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { // ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); // unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } }); builder.create().show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.sure_to_remove) + " (" + device.getName() + ") ?"); builder.setCancelable(false); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { MainApplication.removeWaltzDevice(index); mDeviceListFragment.notifyDataSetChanged(); onRefreshDevice(); ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } }); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); builder.create().show(); } }
From source file:com.smc.tw.waltz.MainActivity.java
private void showOwnerDeleteDeviceDialog(final int index, final int count) { if (DEBUG)/*from ww w . j a v a 2s. c om*/ Log.d(TAG, "showOwnerDeleteDeviceDialog i:" + index); final WaltzDevice device = MainApplication.getWaltzDevice(index); if (MainApplication.isUserSignedIn() && device.isOwnerScope() && (count > 1)) { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.device_owner) + " (" + device.getName() + "). " + getString(R.string.remind_owner)); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { // ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); // unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } }); builder.create().show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.app_name); builder.setMessage(getString(R.string.sure_to_remove) + " (" + device.getName() + ") ? " + getString(R.string.device_owner) + "."); builder.setCancelable(false); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { MainApplication.removeWaltzDevice(index); mDeviceListFragment.notifyDataSetChanged(); onRefreshDevice(); ParsePush.unsubscribeInBackground("WALTZ_" + device.getSerial()); unsubscribeGcmChannel("WALTZ_" + device.getSerial()); } }); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); builder.create().show(); } }
From source file:com.smc.tw.waltz.MainActivity.java
private void showInitializationFailDialog(String name, String uid, int error) { if (DEBUG)/*from w ww . j a v a 2s. c o m*/ Log.d(TAG, "showInitializationFailDialog n:" + name + " u:" + uid + " e:" + error); String message = getString(R.string.dialog_fail_to_connect) + " " + name; switch (error) { case TutkErrorCode.TUTK_ERROR_IOTC_NOT_INITIALIZED: { message = getString(R.string.tutk_error_not_initialized); break; } case TutkErrorCode.TUTK_ERROR_IOTC_DEVICE_NOT_FOUND: { message = String.format(getString(R.string.tutk_error_device_not_found), name); break; } case TutkErrorCode.TUTK_ERROR_IOTC_TIMEOUT: case TutkErrorCode.TUTK_ERROR_IOTC_TIMEOUT_DISCONNECT: { message = String.format(getString(R.string.tutk_error_connection_timeout), name); break; } case TutkErrorCode.TUTK_ERROR_IOTC_RELAY_FAIL: { message = String.format(getString(R.string.tutk_error_relay_fail), name); break; } case TutkErrorCode.TUTK_ERROR_TUNNEL_UID_NO_PERMISSION: case TutkErrorCode.TUTK_ERROR_TUNNEL_UID_RELAY_NOT_SUPPORT: case TutkErrorCode.TUTK_ERROR_IOTC_NO_PERMISSION: case TutkErrorCode.TUTK_ERROR_IOTC_RELAY_NOT_SUPPORT: { message = String.format(getString(R.string.tutk_error_relay_not_support), name); break; } case TutkErrorCode.TUTK_ERROR_TUNNEL_AUTH_FAIL: { message = String.format(getString(R.string.tutk_error_auth_fail), name); break; } case TutkErrorCode.TUTK_ERROR_TUNNEL_NETWORK_UNREACHABLE: case TutkErrorCode.TUTK_ERROR_IOTC_NETWORK_UNREACHABLE: { message = getString(R.string.tutk_error_network_unreachable); break; } case TutkErrorCode.TUTK_ERROR_TUNNEL_MAX_CONNECTION_EXCEED: case TutkErrorCode.TUTK_ERROR_TUNNEL_MAX_SESSION_EXCEED: case TutkErrorCode.TUTK_ERROR_IOTC_MAX_SESSION_EXCEED: case TutkErrorCode.TUTK_ERROR_IOTC_MAX_CHANNEL_EXCEED: case TutkErrorCode.TUTK_ERROR_IOTC_DEVICE_MAX_SESSION_EXCEED: { message = String.format(getString(R.string.tutk_error_max_connection_exceed), name); break; } case TutkErrorCode.TUTK_ERROR_TUNNEL_UID_NOT_LICENSED: case TutkErrorCode.TUTK_ERROR_IOTC_UID_NOT_LICENSED: { message = String.format(getString(R.string.tutk_error_uid_not_licensed), uid, name); break; } case TutkErrorCode.TUTK_ERROR_IOTC_INVALID_SID: case TutkErrorCode.TUTK_ERROR_TUNNEL_INVALID_SID: { message = String.format(getString(R.string.tutk_error_sid_invalid), name); break; } case TutkErrorCode.TUTK_ERROR_IOTC_SERVER_NO_RESPONSE: case TutkErrorCode.TUTK_ERROR_IOTC_SERVER_HOSTNAME_FAIL: { message = getString(R.string.tutk_error_server_unreachable); break; } case TutkErrorCode.TUTK_ERROR_TUNNEL_DISCONNECTED: { message = String.format(getString(R.string.tutk_error_disconnected), name); break; } default: message = getString(R.string.dialog_fail_to_connect) + " " + name; break; } if (mInitializationFailDialog != null) { mInitializationFailDialog.setMessage(message); mInitializationFailDialog.show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.dialog_connection_fail); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { showDeviceList(); } }); builder.setMessage(message); builder.create().show(); } }
From source file:dentex.youtube.downloader.DashboardActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); String previousJson = Json.readJsonDashboardFile(sDashboard); boolean smtInProgressOrPaused = (previousJson.contains(YTD.JSON_DATA_STATUS_IN_PROGRESS) || previousJson.contains(YTD.JSON_DATA_STATUS_PAUSED)); switch (item.getItemId()) { case R.id.menu_search: BugSenseHandler.leaveBreadcrumb("ShareActivity_menu_search"); if (!isSearchBarVisible) { spawnSearchBar();/*from w w w .j a v a 2s .c o m*/ } else { hideSearchBar(); } return true; case R.id.menu_backup: BugSenseHandler.leaveBreadcrumb("ShareActivity_menu_backup"); if (YTD.JSON_FILE.exists() && !previousJson.equals("{}\n") && !smtInProgressOrPaused) { boolean backupCheckboxEnabled = YTD.settings.getBoolean("dashboard_backup_info", true); if (backupCheckboxEnabled == true) { AlertDialog.Builder adb = new AlertDialog.Builder(boxThemeContextWrapper); LayoutInflater adbInflater = LayoutInflater.from(DashboardActivity.this); View showAgainView = adbInflater.inflate(R.layout.dialog_show_again_checkbox, null); final CheckBox showAgain = (CheckBox) showAgainView.findViewById(R.id.showAgain2); showAgain.setChecked(true); adb.setView(showAgainView); adb.setTitle(getString(R.string.information)); adb.setMessage(getString(R.string.menu_backup_info)); adb.setIcon(android.R.drawable.ic_dialog_info); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (!showAgain.isChecked()) { YTD.settings.edit().putBoolean("dashboard_backup_info", false).apply(); Utils.logger("d", "dashboard backup info checkbox disabled", DEBUG_TAG); } launchFcForBackup(); } }); adb.setNegativeButton(R.string.dialogs_negative, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // cancel } }); secureShowDialog(adb); } else { launchFcForBackup(); } } else { toastOpsNotExecuted(); } return true; case R.id.menu_restore: BugSenseHandler.leaveBreadcrumb("ShareActivity_menu_restore"); if (!smtInProgressOrPaused) { boolean restoreCheckboxEnabled = YTD.settings.getBoolean("dashboard_restore_info", true); if (restoreCheckboxEnabled == true) { AlertDialog.Builder adb = new AlertDialog.Builder(boxThemeContextWrapper); LayoutInflater adbInflater = LayoutInflater.from(DashboardActivity.this); View showAgainView = adbInflater.inflate(R.layout.dialog_show_again_checkbox, null); final CheckBox showAgain = (CheckBox) showAgainView.findViewById(R.id.showAgain2); showAgain.setChecked(true); adb.setView(showAgainView); adb.setTitle(getString(R.string.information)); adb.setMessage(getString(R.string.menu_restore_info) + ".\n" + getString(R.string.menu_restore_info_msg)); adb.setIcon(android.R.drawable.ic_dialog_info); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (!showAgain.isChecked()) { YTD.settings.edit().putBoolean("dashboard_restore_info", false).apply(); Utils.logger("d", "dashboard restore info checkbox disabled", DEBUG_TAG); } launchFcForRestore(); } }); adb.setNegativeButton(R.string.dialogs_negative, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // cancel } }); secureShowDialog(adb); } else { launchFcForRestore(); } } else { toastOpsNotExecuted(); } return true; case R.id.menu_import: BugSenseHandler.leaveBreadcrumb("ShareActivity_menu_import"); boolean importCheckboxEnabled1 = YTD.settings.getBoolean("dashboard_import_info", true); if (importCheckboxEnabled1 == true) { AlertDialog.Builder adb = new AlertDialog.Builder(boxThemeContextWrapper); LayoutInflater adbInflater = LayoutInflater.from(DashboardActivity.this); View showAgainView = adbInflater.inflate(R.layout.dialog_show_again_checkbox, null); final CheckBox showAgain = (CheckBox) showAgainView.findViewById(R.id.showAgain2); showAgain.setChecked(true); adb.setView(showAgainView); adb.setTitle(getString(R.string.information)); adb.setMessage(getString(R.string.menu_import_info)); adb.setIcon(android.R.drawable.ic_dialog_info); adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (!showAgain.isChecked()) { YTD.settings.edit().putBoolean("dashboard_import_info", false).apply(); Utils.logger("d", "dashboard import info checkbox disabled", DEBUG_TAG); } launchFcForImport(); } }); adb.setNegativeButton(R.string.dialogs_negative, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // cancel } }); secureShowDialog(adb); } else { launchFcForImport(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.smc.tw.waltz.MainActivity.java
private void showRenameDeviceDialog(int index) { if (DEBUG)//from ww w . ja v a 2 s . c o m Log.d(TAG, "showRenameDeviceDialog i:" + index); final WaltzDevice device = MainApplication.getWaltzDevice(index); LayoutInflater inflater = LayoutInflater.from(MainActivity.this); View dialogView = inflater.inflate(R.layout.dialog_edit_device, null); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); final EditText deviceNameText = (EditText) dialogView.findViewById(R.id.text_device_name); String name = device.getName(); deviceNameText.setText(name); deviceNameText.setSelection((name.length() > 0) ? (name.length()) : 0); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.dialog_edit_device); builder.setView(dialogView); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { String deviceName = deviceNameText.getText().toString(); if (deviceName != null && deviceName.length() > 0) { device.setName(deviceName); MainApplication.renameWaltzDevice(index, deviceName); // rename device name in lcoud MainApplication.saveDeviceList(); mDeviceListFragment.notifyDataSetChanged(); } } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); builder.create().show(); }
From source file:com.smc.tw.waltz.MainActivity.java
private void showInputAccessCodeDialog(int index) { if (DEBUG)//from w ww .ja v a 2s . c o m Log.d(TAG, "showInputAccessCodeDialog i:" + index); if (index < 0 || index >= MainApplication.getWaltzDeviceNumber()) return; if (mInputAccessCodeDialog != null) { mInputAccessCodeDialog.dismiss(); } final WaltzDevice device = MainApplication.getWaltzDevice(index); LayoutInflater inflater = LayoutInflater.from(MainActivity.this); View dialogView = inflater.inflate(R.layout.dialog_access_code_input, null); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); final TextView textView = (TextView) dialogView.findViewById(R.id.input_access_code_text); final PinEditText pinView = (PinEditText) dialogView.findViewById(R.id.input_access_code_view); final String name = device.getName(); textView.setText(getString(R.string.dialog_access_code_input) + " " + name); builder.setIcon(R.drawable.ic_launcher); builder.setTitle(R.string.dialog_access_code); builder.setView(dialogView); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { String pinText = pinView.getText().toString(); //20160223 joyce add if (pinText == null || pinText.isEmpty() || pinText.length() <= 5) { showAccessCodeLengthWrongDialog(); return; } device.checkAccessCode(pinText); if (mProgressDialog != null) { mProgressDialog.setMessage(getString(R.string.main_connecting) + " " + name + "..."); mProgressDialog.show(); } } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { } }); mInputAccessCodeDialog = builder.create(); pinView.setOnPinListener(new PinEditText.OnPinListener() { @Override public void onPincodeDone() { if (DEBUG) Log.d(TAG, "showInputAccessCodeDialog t:" + pinView.getText().toString()); } }); mInputAccessCodeDialog.show(); }
From source file:com.pranavpandey.smallapp.sample.AboutDialog.java
/** * Creates a {@link AboutDialog} with the arguments supplied to the constructor. * Modify this function to open your links. It is the only method to change * default links./*from w w w .j a v a2 s . c o m*/ * * @param rootView Root view to which the dialog should attach. * * @return An {@link android.app.AlertDialog} with app and developer info. */ private void createDialog(@NonNull final View rootView) { final AlertDialog.Builder builder = new AlertDialog.Builder(mContext); View view = LayoutInflater.from(mContext).inflate(R.layout.sas_dialog_about, new LinearLayout(mContext), false); ((ImageView) view.findViewById(R.id.img_app)).setImageResource(mAppIcon); ((TextView) view.findViewById(R.id.txt_name)).setText(mAppName); String version; try { version = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { version = new String(); } ((TextView) view.findViewById(R.id.txt_version)) .setText(String.format(mContext.getString(R.string.sas_version), version)); view.findViewById(R.id.web_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmallUtils.openLink(mContext, rootView, "http://www.pranavpandey.com", null, mType); dismissDialog(); } }); view.findViewById(R.id.facebook_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmallUtils.openLink(mContext, rootView, "fb://facewebmodal/f?href=" + "https://www.facebook.com/PranavPandeDev", "https://www.facebook.com/pranavpandedev", mType); dismissDialog(); } }); view.findViewById(R.id.twitter_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmallUtils.openLink(mContext, rootView, "twitter://user?user_id=630336695", "https://twitter.com/pranavpandeydev", mType); mDialog.dismiss(); } }); view.findViewById(R.id.google_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmallUtils.openLink(mContext, rootView, "https://plus.google.com/+pranavpandeydev", null, mType); dismissDialog(); } }); view.findViewById(R.id.linkedin_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmallUtils.openLink(mContext, rootView, "https://in.linkedin.com/in/pranav-pandey-09032974", null, mType); dismissDialog(); } }); view.findViewById(R.id.github_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SmallUtils.openLink(mContext, rootView, "https://github.com/pranavpandey", null, mType); dismissDialog(); } }); builder.setTitle(R.string.sas_about); builder.setView(view); if (mDialogIcon != null) { builder.setIcon(DynamicTheme.colorizeDrawable(mDialogIcon, SmallTheme.getInstance().getPrimaryColor())); } builder.setNegativeButton(android.R.string.cancel, null).setPositiveButton(R.string.sas_more_apps, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SmallUtils.openLink(mContext, rootView, "market://search?q=pub:Pranav+Pandey", "http://play.google.com/store/apps/dev?id=6608630615059087491", mType); dismissDialog(); } }); mDialog = SmallUtils.createDialog(builder.create(), rootView.getWindowToken(), view); }
From source file:com.smc.tw.waltz.MainActivity.java
private void showWPSParingDialog(WaltzDevice device) { if (DEBUG)// ww w. j a va 2 s. c om Log.d(TAG, "showWPSParingDialog"); if (mWPSDialog != null) { mWPSDialog.dismiss(); } LayoutInflater inflater = LayoutInflater.from(this); View mDialogView = inflater.inflate(R.layout.sensor_allow_join, null); AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.WaltzDialog); mWPSParingText = (TextView) mDialogView.findViewById(R.id.sensor_allow_join_text); TextView mDeviceNameText = (TextView) mDialogView.findViewById(R.id.device_name); mDeviceNameText.setText(getString(R.string.device) + "(" + device.getName() + ")"); if (mIsEndPrepareParing) mWPSParingText.setText( String.format(getString(R.string.notification_system_wps_still_in_paring), mWPSParingTimeLeft));//mWPSParingCount)); else mWPSParingText.setText(String.format(getString(R.string.notification_system_prepare_wps_paring), mPrepareWPSParingCount));// builder.setIcon(R.drawable.seek_thumb_normal); builder.setTitle(R.string.sensor_allow_join); builder.setView(mDialogView); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int id) { //stopWPSParingTimer(); mIsHasSeenWPSParingAlert = true; stopWPSParingTimeLeftTimer(); } }); mWPSDialog = builder.create(); mWPSDialog.show(); }