List of usage examples for android.app AlertDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:org.ednovo.goorusearchwidget.HomeScreenActivity.java
public void showDialog(String data) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.setMessage(data).setCancelable(false).setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // dialog.cancel(); dialog.cancel();//from www .ja va2 s. c om } }); AlertDialog alert = alertDialog.create(); // Title for AlertDialog alert.setTitle(" Info "); alert.show(); }
From source file:com.example.yudiandrean.socioblood.ChangePassword.java
/** * Called when the activity is first created. *///from ww w . ja v a2 s.c om @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.changepassword); cancel = (Button) findViewById(R.id.btcancel); cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Intent login = new Intent(getApplicationContext(), LoginActivity.class); startActivity(login); finish(); } }); newpass = (EditText) findViewById(R.id.newpass); verifynewpass = (EditText) findViewById(R.id.verifynewpass); alert = (TextView) findViewById(R.id.alertpass); changepass = (Button) findViewById(R.id.btchangepass); changepass.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (newpass.getText().toString().equals("")) { AlertDialog alertDialog = new AlertDialog.Builder(ChangePassword.this).create(); alertDialog.setTitle("Error"); alertDialog.setMessage("Password field is empty"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //dismiss the dialog } }); alertDialog.show(); } else if (!verifynewpass.getText().toString().equals(newpass.getText().toString())) { AlertDialog alertDialog = new AlertDialog.Builder(ChangePassword.this).create(); alertDialog.setTitle("Error"); alertDialog.setMessage("Passwords do not match, try again!"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //dismiss the dialog } }); alertDialog.show(); } else { NetAsync(view); } } }); }
From source file:fr.android.earthdawn.activities.CharacterSheetActivity.java
@Override protected void onPrepareDialog(final int id, final Dialog dialog, final Bundle args) { final AlertDialog alert = (AlertDialog) dialog; switch (id) { case Constants.DIALOG_SHOW_DETAILS: alert.setTitle(getString(R.string.roller_popup_title2, getString(EDDicesLauncher.getRollType()))); alert.setMessage(EDDicesLauncher.getDetailedMessage(this)); break;/* w w w. j ava2s . co m*/ case Constants.DIALOG_SHOW_DAMAGES_TAKEN: alert.setTitle(R.string.popup_damages_taken_title); alert.setMessage(getString(R.string.popup_damages_taken_msg, args.getCharSequence(Constants.BUNDLE_DMG_TAKEN_ARM), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_PV)), Integer.toString(args.getInt(Constants.BUNDLE_DMG_TAKEN_WOUND)))); break; default: break; } super.onPrepareDialog(id, dialog, args); }
From source file:org.quantumbadger.redreader.reddit.prepared.RedditPreparedPost.java
public static void onActionMenuItemSelected(final RedditPreparedPost post, final Activity activity, final Action action) { switch (action) { case UPVOTE:/*from ww w .j av a 2 s .co m*/ post.action(activity, RedditAPI.RedditAction.UPVOTE); break; case DOWNVOTE: post.action(activity, RedditAPI.RedditAction.DOWNVOTE); break; case UNVOTE: post.action(activity, RedditAPI.RedditAction.UNVOTE); break; case SAVE: post.action(activity, RedditAPI.RedditAction.SAVE); break; case UNSAVE: post.action(activity, RedditAPI.RedditAction.UNSAVE); break; case HIDE: post.action(activity, RedditAPI.RedditAction.HIDE); break; case UNHIDE: post.action(activity, RedditAPI.RedditAction.UNHIDE); break; case DELETE: new AlertDialog.Builder(activity).setTitle(R.string.accounts_delete).setMessage(R.string.delete_confirm) .setPositiveButton(R.string.action_delete, new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { post.action(activity, RedditAPI.RedditAction.DELETE); } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; case REPORT: new AlertDialog.Builder(activity).setTitle(R.string.action_report) .setMessage(R.string.action_report_sure) .setPositiveButton(R.string.action_report, new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { post.action(activity, RedditAPI.RedditAction.REPORT); // TODO update the view to show the result // TODO don't forget, this also hides } }).setNegativeButton(R.string.dialog_cancel, null).show(); break; case EXTERNAL: { final Intent intent = new Intent(Intent.ACTION_VIEW); String url = (activity instanceof WebViewActivity) ? ((WebViewActivity) activity).getCurrentUrl() : post.url; intent.setData(Uri.parse(url)); activity.startActivity(intent); break; } case SELFTEXT_LINKS: { final HashSet<String> linksInComment = LinkHandler .computeAllLinks(StringEscapeUtils.unescapeHtml4(post.src.selftext)); if (linksInComment.isEmpty()) { General.quickToast(activity, R.string.error_toast_no_urls_in_self); } else { final String[] linksArr = linksInComment.toArray(new String[linksInComment.size()]); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setItems(linksArr, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { LinkHandler.onLinkClicked(activity, linksArr[which], false, post.src); dialog.dismiss(); } }); final AlertDialog alert = builder.create(); alert.setTitle(R.string.action_selftext_links); alert.setCanceledOnTouchOutside(true); alert.show(); } break; } case SAVE_IMAGE: { final RedditAccount anon = RedditAccountManager.getAnon(); LinkHandler.getImageInfo(activity, post.url, Constants.Priority.IMAGE_VIEW, 0, new GetImageInfoListener() { @Override public void onFailure(final RequestFailureType type, final Throwable t, final StatusLine status, final String readableMessage) { final RRError error = General.getGeneralErrorForFailure(activity, type, t, status, post.url); General.showResultDialog(activity, error); } @Override public void onSuccess(final ImgurAPI.ImageInfo info) { CacheManager.getInstance(activity) .makeRequest(new CacheRequest(General.uriFromString(info.urlOriginal), anon, null, Constants.Priority.IMAGE_VIEW, 0, CacheRequest.DownloadType.IF_NECESSARY, Constants.FileType.IMAGE, false, false, false, activity) { @Override protected void onCallbackException(Throwable t) { BugReportActivity.handleGlobalError(context, t); } @Override protected void onDownloadNecessary() { General.quickToast(context, R.string.download_downloading); } @Override protected void onDownloadStarted() { } @Override protected void onFailure(RequestFailureType type, Throwable t, StatusLine status, String readableMessage) { final RRError error = General.getGeneralErrorForFailure(context, type, t, status, url.toString()); General.showResultDialog(activity, error); } @Override protected void onProgress(boolean authorizationInProgress, long bytesRead, long totalBytes) { } @Override protected void onSuccess(CacheManager.ReadableCacheFile cacheFile, long timestamp, UUID session, boolean fromCache, String mimetype) { File dst = new File( Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), General.uriFromString(info.urlOriginal).getPath()); if (dst.exists()) { int count = 0; while (dst.exists()) { count++; dst = new File( Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), count + "_" + General.uriFromString(info.urlOriginal) .getPath().substring(1)); } } try { final InputStream cacheFileInputStream = cacheFile.getInputStream(); if (cacheFileInputStream == null) { notifyFailure(RequestFailureType.CACHE_MISS, null, null, "Could not find cached image"); return; } General.copyFile(cacheFileInputStream, dst); } catch (IOException e) { notifyFailure(RequestFailureType.STORAGE, e, null, "Could not copy file"); return; } activity.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + dst.getAbsolutePath()))); General.quickToast(context, context.getString(R.string.action_save_image_success) + " " + dst.getAbsolutePath()); } }); } @Override public void onNotAnImage() { General.quickToast(activity, R.string.selected_link_is_not_image); } }); break; } case SHARE: { final Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("text/plain"); mailer.putExtra(Intent.EXTRA_SUBJECT, post.title); mailer.putExtra(Intent.EXTRA_TEXT, post.url); activity.startActivity(Intent.createChooser(mailer, activity.getString(R.string.action_share))); break; } case SHARE_COMMENTS: { final Intent mailer = new Intent(Intent.ACTION_SEND); mailer.setType("text/plain"); mailer.putExtra(Intent.EXTRA_SUBJECT, "Comments for " + post.title); mailer.putExtra(Intent.EXTRA_TEXT, Constants.Reddit.getUri(Constants.Reddit.PATH_COMMENTS + post.idAlone).toString()); activity.startActivity( Intent.createChooser(mailer, activity.getString(R.string.action_share_comments))); break; } case COPY: { ClipboardManager manager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); manager.setText(post.url); break; } case GOTO_SUBREDDIT: { try { final Intent intent = new Intent(activity, PostListingActivity.class); intent.setData(SubredditPostListURL.getSubreddit(post.src.subreddit).generateJsonUri()); activity.startActivityForResult(intent, 1); } catch (RedditSubreddit.InvalidSubredditNameException e) { Toast.makeText(activity, R.string.invalid_subreddit_name, Toast.LENGTH_LONG).show(); } break; } case USER_PROFILE: LinkHandler.onLinkClicked(activity, new UserProfileURL(post.src.author).toString()); break; case PROPERTIES: PostPropertiesDialog.newInstance(post.src).show(activity.getFragmentManager(), null); break; case COMMENTS: ((RedditPostView.PostSelectionListener) activity).onPostCommentsSelected(post); break; case LINK: ((RedditPostView.PostSelectionListener) activity).onPostSelected(post); break; case COMMENTS_SWITCH: if (!(activity instanceof MainActivity)) activity.finish(); ((RedditPostView.PostSelectionListener) activity).onPostCommentsSelected(post); break; case LINK_SWITCH: if (!(activity instanceof MainActivity)) activity.finish(); ((RedditPostView.PostSelectionListener) activity).onPostSelected(post); break; case ACTION_MENU: showActionMenu(activity, post); break; case REPLY: final Intent intent = new Intent(activity, CommentReplyActivity.class); intent.putExtra("parentIdAndType", post.idAndType); activity.startActivity(intent); break; } }
From source file:com.telestax.restcomm_olympus.MainFragment.java
private void showOkAlert(final String title, final String detail) { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle(title); alertDialog.setMessage(detail);//from w w w.ja v a 2 s.com alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); }
From source file:dk.kasperbaago.JSONHandler.JSONHandler.java
/** * Shows an error to the user, if the request fails. * Callback is NOT called if this is shown. To still run callback and use your own error handler, use showErrMsg(false); *//*ww w. j a v a 2s .com*/ private void showErrorMsg() { AlertDialog alert = new AlertDialog.Builder(this.context).create(); alert.setTitle(this.errorMsgTitle); alert.setMessage(this.errorMsgTxt); alert.setButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); }
From source file:com.deemsys.lmsmooc.BillingFragment.java
@SuppressWarnings("deprecation") @Override/*from ww w . ja v a 2 s .com*/ public void onResume() { super.onResume(); if (isInternetPresent) { // onResume(); new Details().execute(); } else { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle("Sorry User"); alertDialog.setMessage("No network connection."); alertDialog.setIcon(R.drawable.delete); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { } }); alertDialog.show(); } }
From source file:com.altcanvas.twitspeak.TwitSpeakActivity.java
private void promptTTSInstall() { AlertDialog ttsInstallDlg = new AlertDialog.Builder(this).create(); ttsInstallDlg.setMessage(getString(R.string.tts_install_msg)); ttsInstallDlg.setTitle(getString(R.string.tts_install_title)); ttsInstallDlg.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.proceed_str), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel();/*from ww w . j a va 2 s.c o m*/ Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); } }); ttsInstallDlg.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel_str), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); finish(); } }); }
From source file:com.prof.youtubeparser.example.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { android.support.v7.app.AlertDialog alertDialog = new android.support.v7.app.AlertDialog.Builder( MainActivity.this).create(); alertDialog.setTitle(R.string.app_name); alertDialog.setMessage(Html.fromHtml(MainActivity.this.getString(R.string.info_text) + " <a href='http://github.com/prof18/YoutubeParser'>GitHub.</a>" + MainActivity.this.getString(R.string.author))); alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); }/*from w w w . ja v a 2s . c o m*/ }); alertDialog.show(); ((TextView) alertDialog.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } return super.onOptionsItemSelected(item); }
From source file:com.ceino.chaperonandroid.activities.LicenseActivity.java
public void showAlertDialog(Activity context, String title, String message, Boolean status) { AlertDialog alertDialog = new AlertDialog.Builder(context).create(); // Setting Dialog Title alertDialog.setTitle(title); // Setting Dialog Message alertDialog.setMessage(message);/*from w w w. ja va 2 s . c o m*/ // Setting alert dialog icon alertDialog.setIcon((status) ? R.drawable.ic_launcher : R.drawable.ic_launcher); // Setting OK Button alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }); // Showing Alert Message alertDialog.show(); }