List of usage examples for android.app AlertDialog.Builder setMessage
public void setMessage(CharSequence message)
From source file:com.chaosinmotion.securechat.fragments.OnboardingCreateAccount.java
@Override public void doNext() { String uname = username.getText().toString(); String pwd = password.getText().toString(); if (!PasswordComplexity.complexityTest(pwd)) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.weak_password_message); builder.setTitle(R.string.weak_password_title); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override/* w w w .ja va 2s.co m*/ public void onClick(DialogInterface dialog, int which) { // Ignore } }); builder.show(); } final SCNetworkCredentials creds = new SCNetworkCredentials(uname); creds.setPasswordFromClearText(pwd); try { JSONObject json = new JSONObject(); json.put("username", creds.getUsername()); json.put("password", creds.getPassword()); json.put("deviceid", SCRSAManager.shared().getDeviceUUID()); json.put("pubkey", SCRSAManager.shared().getPublicKey()); SCNetwork.get().request("login/createaccount", json, this, new SCNetwork.ResponseInterface() { @Override public void responseResult(SCNetwork.Response response) { if (response.isSuccess()) { /* * Success. Save the username and password, * and save the whole thing to the back end. */ SCRSAManager.shared().setCredentials(creds.getUsername(), creds.getPassword()); SCRSAManager.shared().encodeSecureData(getActivity()); /* * We have what we need to start the queue */ SCMessageQueue.get().startQueue(getActivity()); /* * Done. Go to the next page */ wizardInterface.transitionToFragment(new OnboardingFinished()); } } }); } catch (JSONException ex) { } }
From source file:com.chaosinmotion.securechat.fragments.ChangePasswordStart.java
@Override public void doNext() { String password = newPassword.getText().toString(); if (!PasswordComplexity.complexityTest(password)) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.weak_password_message); builder.setTitle(R.string.weak_password_title); builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { @Override/*w w w. ja v a 2 s. c om*/ public void onClick(DialogInterface dialog, int which) { // Ignore } }); builder.show(); return; } String retypedPassword = copyPassword.getText().toString(); if (!retypedPassword.equals(password)) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.change_password_not_matched_message); builder.setTitle(R.string.change_password_not_matched_title); builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Ignore } }); builder.show(); return; } changePassword(oldPassword.getText().toString(), password); }
From source file:me.ziccard.secureit.async.upload.AuthenticatorTask.java
/** * Shows an authentication failure dialog */// www . j av a 2 s . co m public void showFailureDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setMessage("Authentication failed").setCancelable(false).setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); }
From source file:com.chaosinmotion.securechat.fragments.LoginAccount.java
private void displayError() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.login_error_message); builder.setTitle(R.string.login_error_title); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override/*w w w . jav a 2s .c o m*/ public void onClick(DialogInterface dialog, int which) { // Ignore } }); builder.show(); return; }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog containing the code received by goo.gl if any, or an error * message stating that the pairing operation failed. * //from ww w . ja va 2s .c om * @param googl * the pairing code retrieved by goo.gl * @param activity * the caller activity */ public static void onObtainPairingCode(final String googl, final MainActivity activity) { new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = getBuilder(activity); if (googl != null) { View layout = View.inflate(getContext(), R.layout.pairing_code_dialog, null); TextView message = (TextView) layout.findViewById(R.id.pairingCode); Typeface typeFace = Typeface.createFromAsset(activity.getAssets(), CUSTOM_TYPEFACE_PATH); message.setTypeface(typeFace); message.setText(googl); builder.setView(layout); } else { builder.setMessage(getResources().getString(R.string.code_dialog_fail)); } builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (googl != null) { Resources res = getResources(); String howManyTotal = res.getQuantityString(R.plurals.added_device, activity.getInboundDevicesCount(), activity.getInboundDevicesCount()); Toast.makeText(getActivity(), res.getString(R.string.device_paired, howManyTotal), Toast.LENGTH_LONG).show(); } } }); return builder.create(); } }.show(activity.getSupportFragmentManager(), "resultCode"); }
From source file:de.thecamper.android.androidtools.UpdateChecker.java
/** * show a AlertDialog to inform the user of the update and let him download * the new version of the app// w ww . j a v a 2 s . c o m */ public void showUpdateAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(context.getString(R.string.updateTitle)); builder.setMessage(context.getString(R.string.updateAvailable)); builder.setCancelable(false); builder.setPositiveButton(context.getString(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(appURL)); context.startActivity(intent); ((Activity) context).finish(); } }); builder.setNegativeButton(context.getString(R.string.later), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.chaosinmotion.securechat.fragments.OnboardingLoginAccount.java
@Override public void doNext() { String uname = username.getText().toString(); String pwd = password.getText().toString(); final SCNetworkCredentials creds = new SCNetworkCredentials(uname); creds.setPasswordFromClearText(pwd); SCNetwork.get().doLogin(creds, new SCNetwork.LoginCallback() { @Override/*from w w w. j av a 2s . c om*/ public void loginResult(int reason) { if (reason == SCNetwork.LOGIN_SUCCESS) { /* * Login success. Register device */ SCRSAManager.shared().setCredentials(creds.getUsername(), creds.getPassword()); SCRSAManager.shared().encodeSecureData(getActivity()); try { /* * Register device */ JSONObject d = new JSONObject(); d.put("deviceid", SCRSAManager.shared().getDeviceUUID()); d.put("pubkey", SCRSAManager.shared().getPublicKey()); SCNetwork.get().request("device/adddevice", d, this, new SCNetwork.ResponseInterface() { @Override public void responseResult(SCNetwork.Response response) { if (response.isSuccess()) { SCMessageQueue.get().startQueue(getActivity()); wizardInterface.transitionToFragment(new OnboardingFinished()); } } }); } catch (JSONException ex) { } } else if (reason == SCNetwork.LOGIN_FAILURE) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setMessage(R.string.login_error_message); builder.setTitle(R.string.login_error_title); builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Ignore } }); builder.show(); } } }); }
From source file:com.photon.phresco.hybrid.eshop.activity.PhrescoActivity.java
/** * Show the error message dialog box with OK button * //w w w . ja va 2 s. c o m * @param errorMessage */ public void showErrorDialog(String errorMessage) { try { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(errorMessage).setTitle(R.string.app_name).setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); // System.runFinalizersOnExit(true); android.os.Process.killProcess(android.os.Process.myPid()); } }); @SuppressWarnings("unused") AlertDialog alert = builder.show(); } catch (Exception ex) { PhrescoLogger.info(TAG + "showErrorDialog: " + ex.toString()); PhrescoLogger.warning(ex); } }
From source file:com.developer.album.ActivityPhotoView.java
private void showAlertDialog() { DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @Override// w w w .j av a 2 s . c o m public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: //Yes button clicked DataKeeper dataKeeper = DataKeeper.sharedInstance(); SafeJSONArray album_json_array = dataKeeper.getAlbums(ActivityPhotoView.this); SafeJSONObject album_item = album_json_array.getJSONObject(index_of_album); SafeJSONArray all_path = album_item.getJSONArray("all_path"); JSONArray new_all_path = all_path.remove(mViewPager.getCurrentItem(), all_path); //update values album_item.putSafeJSONArray("all_path", new_all_path); album_item.putInt("total_album_pics", new_all_path.length()); // save and finish dataKeeper.saveAlbums(ActivityPhotoView.this, album_json_array.toString()); setResult(RESULT_OK); finish(); break; case DialogInterface.BUTTON_NEGATIVE: //No button clicked break; } } }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener) .setNegativeButton("No", dialogClickListener).show(); }
From source file:com.javierc.albuquerquenow.SearchMap.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub if (item.getItemId() == android.R.id.home) { this.finish(); } else if (item.getItemId() == R.id.action_legalnotices) { String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(SearchMap.this); LicenseDialog.setTitle("Legal Notices"); LicenseDialog.setMessage(LicenseInfo); LicenseDialog.show();/*from w w w. j av a 2s . co m*/ } return super.onOptionsItemSelected(item); }