List of usage examples for android.content DialogInterface cancel
void cancel();
From source file:com.cypress.cysmart.GATTDBFragments.GattDetailsFragment.java
void showHIDWarningMessage() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); // set title// ww w .ja v a 2 s .c o m alertDialogBuilder.setTitle(R.string.app_name); // set dialog message alertDialogBuilder.setMessage(R.string.alert_message_hid_warning).setCancelable(false) .setPositiveButton(R.string.alert_message_exit_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:com.einzig.ipst2.activities.MainActivity.java
/** * Search through accounts on the user's device now that we have permission to do so. *//*w w w. jav a 2 s . c o m*/ public void gotAccountsPermission() { AccountManager manager = AccountManager.get(MainActivity.this); int numGoogAcct = 0; Account[] accountList = manager.getAccounts(); for (Account a : accountList) { if (a.type.equals("com.google")) { numGoogAcct++; } } if (numGoogAcct == 0) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, ThemeHelper.getDialogTheme(this)); builder.setTitle(R.string.noaccountstitle); builder.setMessage(R.string.noaccountsmessage);//. Would you like to log in manually?") builder.setCancelable(true); builder.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); } else { runOnUiThread(new Runnable() { @Override public void run() { findViewById(R.id.progress_view_mainactivity).setVisibility(View.VISIBLE); findViewById(R.id.gmail_login_button).setVisibility(View.INVISIBLE); } }); Intent intent = AccountManager.newChooseAccountIntent(null, null, new String[] { "com.google" }, false, null, null, null, null); startActivityForResult(intent, LOGIN_ACTIVITY_CODE); } }
From source file:ca.cs.ualberta.localpost.view.MapsView.java
/** * Dialog box to determine whether the user is sure about the selection *//*from w w w .j a v a2 s . c o m*/ private void alertDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.dialog_message).setTitle(R.string.dialog_title) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Close dialog dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
From source file:bizapps.com.healthforusPatient.activity.RegisterActivity.java
public void showErrorDialog(String msg, final boolean isVerify) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); // set title/*from w ww . j av a 2 s. co m*/ alertDialogBuilder.setTitle("Info"); // set dialog message alertDialogBuilder.setMessage(msg).setCancelable(false).setNegativeButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); if (status.equalsIgnoreCase("success") && isVerify) { verifyAccount(); } else { Intent intent = new Intent(RegisterActivity.this, LoginActivity.class); startActivity(intent); finish(); } } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java
private void successDialog(int i) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); if (i == 2 || i == 3) { alertDialog.setTitle(" ? "); alertDialog.setMessage("? ? ??"); } else if (i == 1) { alertDialog.setTitle(" "); alertDialog.setMessage("? ? ?"); } else if (i == 4) { alertDialog.setTitle(" "); alertDialog.setMessage("? ? ?"); }/*from w w w .jav a 2s . c o m*/ alertDialog.setIcon(R.drawable.ic_dialog_alert); alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to invoke YES event dialog.cancel(); getMyBeaconList(); } }); alertDialog.show(); }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java
private void failDialog(int i) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); if (i == 2 || i == 3) { alertDialog.setTitle(" ? "); alertDialog.setMessage("? ? "); } else if (i == 1) { alertDialog.setTitle(" "); alertDialog.setMessage(" ? "); } else if (i == 4) { alertDialog.setTitle(" "); alertDialog.setMessage(" ? "); }/*from w w w . j a v a 2 s. com*/ alertDialog.setIcon(R.drawable.fail); // Setting Positive "Yes" Button alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to invoke YES event dialog.cancel(); } }); alertDialog.show(); }
From source file:com.duy.pascal.ui.editor.BaseEditorActivity.java
@Override public void saveAs() { saveFile();/*from w w w . j a v a 2s . c o m*/ final AppCompatEditText edittext = new AppCompatEditText(this); edittext.setHint(R.string.enter_new_file_name); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.save_as).setView(edittext).setIcon(R.drawable.ic_create_new_folder_white_24dp) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { String fileName = edittext.getText().toString(); dialog.cancel(); File currentFile = getCurrentFile(); if (currentFile != null) { try { mFileManager.copy(currentFile.getPath(), currentFile.getParent() + "/" + fileName); } catch (IOException e) { e.printStackTrace(); Toast.makeText(BaseEditorActivity.this, R.string.can_not_save_file, Toast.LENGTH_SHORT).show(); } } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.create().show(); }
From source file:com.safecell.LoginActivity.java
private synchronized void updateProfile() { Log.d(TAG, "Getting profile trips from server"); HttpResponse profileResponse;//w ww . j a v a 2 s . co m profileResponse = accountUpdateProfileResponse(); if (profileResponse != null) { UpdateAccountsDetailsResponseHandler updateAccountsDetailsResponseHandler = new UpdateAccountsDetailsResponseHandler( context); updateAccountsDetailsResponseHandler.updateAccountResponse(profileResponse); RetriveTripsOfProfile retriveTripsOfProfile = new RetriveTripsOfProfile(LoginActivity.this, scProfile.getProfileId(), scAccount.getApiKey()); retriveTripsOfProfile.retrive(); ProfilesRepository profilesRepository = new ProfilesRepository(LoginActivity.this); profilesRepository.insertProfile(scProfile); progressDialog.dismiss(); Log.d(TAG, "Starting home screen activity"); Intent mIntent = new Intent(LoginActivity.this, HomeScreenActivity.class); startActivity(mIntent); finish(); } else { new AlertDialog.Builder(context).setMessage(message) .setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }).show(); } }
From source file:com.buddi.client.dfu.fragment.UploadCancelFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()).setTitle(R.string.dfu_confirmation_dialog_title) .setMessage(R.string.dfu_upload_dialog_cancel_message).setCancelable(false) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override//from ww w . j av a2 s.c o m public void onClick(DialogInterface dialog, int whichButton) { final LocalBroadcastManager manager = LocalBroadcastManager.getInstance(getActivity()); final Intent pauseAction = new Intent(DfuService.BROADCAST_ACTION); pauseAction.putExtra(DfuService.EXTRA_ACTION, DfuService.ACTION_ABORT); manager.sendBroadcast(pauseAction); mListener.onUploadCanceled(); } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).create(); }
From source file:com.example.isse.weatherapp.ui.WeatherListActivity.java
/** * Function to show settings alert dialog *//*from www . j av a 2 s. c o m*/ public void showSettingsAlert() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext); // Setting Dialog Title alertDialog.setTitle(R.string.GPS_Setting); // Setting Dialog Message alertDialog.setMessage(R.string.GPS_Setting_message); // On pressing Settings button alertDialog.setPositiveButton(R.string.settings, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); mContext.startActivity(intent); } }); // on pressing cancel button alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); // Showing Alert Message alertDialog.show(); }