Example usage for android.app AlertDialog.Builder setMessage

List of usage examples for android.app AlertDialog.Builder setMessage

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setMessage.

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:co.dilaver.quoter.fragments.PopularFragment.java

@Override
public void pqInfoClicked() {
    android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity());
    builder.setTitle(getString(R.string.str_Info));
    builder.setMessage(Html.fromHtml(getString(R.string.str_TakenFromReddit)));
    builder.setCancelable(true);/*from  w  ww.  j  av a  2s.c om*/
    builder.show();
}

From source file:com.octade.droid.ilesansfil.IleSansFil.java

private void about() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setMessage("\n" + "Android Application" + "\n" + "version: " + mainApp.getVersion() + "\n\n"
            + "Octade Technologies inc.\n" + "http://octade.virtuelnet.com\n").setInverseBackgroundForced(true)
            .setTitle("Ile sans fil").setIcon(mainApp.getIcon()).setCancelable(true);
    AlertDialog alert = builder.create();
    alert.show();//from w ww. j  av a 2 s.c  o m
}

From source file:com.he5ed.lib.cloudprovider.auth.OAuth2Fragment.java

/**
 * Show authentication error message//from w ww  .  j  av  a2  s. c o m
 */
private void showErrorDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setMessage(R.string.dialog_message_auth_error);
    // Create the AlertDialog
    Dialog dialog = builder.create();
    dialog.show();
}

From source file:fr.gcastel.freeboxV6GeekIncDownloader.services.FreeboxDownloaderService.java

private void showAlertDialog() {
    AlertDialog.Builder alertbox = new AlertDialog.Builder(zeContext);
    alertbox.setMessage(alertDialogMessage);
    alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface arg0, int arg1) {
            dialogueEnCours = DialogEnCours.NONE;
            return;
        }/*from  www .  ja  v a  2 s  .  c o m*/
    });
    alertbox.show();
}

From source file:org.quizpoll.net.HttpHelper.java

/**
 * Shows dialog for forced update/*  ww  w. j  a v a  2  s  .c o m*/
 */
private void showUpgradeRequiredDialog() {
    AlertDialog.Builder alert = new AlertDialog.Builder(activity);
    alert.setTitle(R.string.update_required);
    alert.setMessage(R.string.update_required_description);
    alert.setPositiveButton(R.string.go_to_market, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(AboutActivity.MARKET_LISTING));
            activity.startActivity(intent);
        }
    });
    Dialog dialog = alert.create();
    dialog.setOwnerActivity(activity);
    dialog.show();
}

From source file:com.googlecode.android_scripting.facade.ui.SeekBarDialogTask.java

@Override
public void onCreate() {
    super.onCreate();
    mSeekBar = new SeekBar(getActivity());
    mSeekBar.setMax(mMax);/*w  w  w  .  ja  v  a2s .  co  m*/
    mSeekBar.setProgress(mProgress);
    mSeekBar.setPadding(10, 0, 10, 3);
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        public void onStopTrackingTouch(SeekBar arg0) {
        }

        public void onStartTrackingTouch(SeekBar arg0) {
        }

        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            EventFacade eventFacade = getEventFacade();
            if (eventFacade != null) {
                JSONObject result = new JSONObject();
                try {
                    result.put("which", "seekbar");
                    result.put("progress", mSeekBar.getProgress());
                    result.put("fromuser", fromUser);
                    eventFacade.postEvent("dialog", result);
                } catch (JSONException e) {
                    Log.e(e);
                }
            }
        }
    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    if (mTitle != null) {
        builder.setTitle(mTitle);
    }
    if (mMessage != null) {
        builder.setMessage(mMessage);
    }
    builder.setView(mSeekBar);
    configureButtons(builder, getActivity());
    addOnCancelListener(builder, getActivity());
    mDialog = builder.show();
    mShowLatch.countDown();
}

From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java

public void displayProVersionPromo(String proAppName, String proVersionLink) {
    final String text = "For the cost of a soda, $0.99, you can enable the following features:\n"
            + "- No advertisements\n" + "- Sync frequency/action configuration\n"
            + "- Configure the fields displayed in the add/edit task page.\n\n"
            + "Click the OK button to load the pro version in the market viewer, or Cancel to stay with the free version.";

    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle("Upgrade");
    builder.setMessage(text);
    builder.setPositiveButton(OK_BUTTON_TEXT, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(Constants.PRO_VERSION_LINK));
            activity.startActivity(intent);
        }/*  www .j a va2 s . co m*/
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
        }
    });

    builder.show();
}

From source file:de.grobox.blitzmail.NotificationHandlerActivity.java

@Override
protected void onNewIntent(Intent intent) {
    Bundle extras = intent.getExtras();//from w w w  .ja va2 s . c o m

    // show dialog for server errors
    if (extras != null && extras.getString("ContentTitle").equals(getString(R.string.error))) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setTitle(getString(R.string.app_name) + " - " + getString(R.string.error));
        builder.setMessage(extras.getString("ContentText"));
        builder.setIcon(android.R.drawable.ic_dialog_alert);

        // Add the buttons
        builder.setNegativeButton(getResources().getString(R.string.dismiss),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        deleteMail();
                        // User clicked Cancel button, close this Activity
                        finish();
                    }
                });
        builder.setNeutralButton(getResources().getString(R.string.send_later),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // User clicked Cancel button
                        if (BuildConfig.PRO) {
                            // close this Activity
                            finish();
                        } else {
                            AlertDialog.Builder builder = new AlertDialog.Builder(context);

                            builder.setTitle(getString(R.string.app_name));
                            builder.setMessage(getString(R.string.error_lite_version));
                            builder.setIcon(android.R.drawable.ic_dialog_info);

                            // Add the buttons
                            builder.setPositiveButton(android.R.string.ok,
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface lite_dialog, int id) {
                                            Uri uri = Uri.parse(
                                                    "https://play.google.com/store/apps/details?id=de.grobox.blitzmail.pro");
                                            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                                            if (intent.resolveActivity(getPackageManager()) != null) {
                                                startActivity(intent);
                                            }
                                            lite_dialog.dismiss();
                                            finish();
                                        }
                                    });
                            builder.setNegativeButton(android.R.string.cancel,
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface lite_dialog, int id) {
                                            lite_dialog.dismiss();
                                            finish();
                                        }
                                    });

                            // Create and show the AlertDialog
                            AlertDialog lite_dialog = builder.create();
                            lite_dialog.setCanceledOnTouchOutside(false);
                            lite_dialog.show();
                        }
                    }
                });
        builder.setPositiveButton(getResources().getString(R.string.try_again),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // Prepare start of new activity
                        Intent intent = new Intent(context, SendActivity.class);
                        intent.setAction("BlitzMailReSend");
                        intent.putExtra("mail", mMail.toString());
                        finish();

                        startActivity(intent);
                    }
                });

        // Create and show the AlertDialog
        AlertDialog dialog = builder.create();
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();
    } else {
        // close activity
        finish();
    }
}

From source file:com.example.run_tracker.ProfileFragment.java

@Override
public void onClick(View arg0) {
    Log.v(TAG, "click");
    AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());

    alert.setTitle("Enter Password");
    alert.setMessage("Please enter your password");

    // Set an EditText view to get user input
    final EditText input = new EditText(getActivity());
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    alert.setView(input);//from w w w.j  a v  a  2  s  .  com

    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            String password = input.getText().toString();
            String new_password = null;
            if (!mPassword1.getText().toString().equals(mPassword2.getText().toString())) {

                Toast.makeText(getActivity(), "Passwords dont match", Toast.LENGTH_LONG).show();
            } else {
                if (isEmpty(mPassword1) || (isEmpty(mPassword2))) {
                    new_password = password;
                } else {
                    new_password = mPassword1.getText().toString();
                }
                Make_edit_profile_request(password, new_password);
            }

        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
        }
    });

    alert.show();

}

From source file:dtu.ds.warnme.app.dialog.WarningDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Event event = (Event) getArguments().get(MainActivity.KEY_EVENT);

    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity());
    dialogBuilder.setTitle(R.string.warning);
    dialogBuilder.setMessage(getMessage(event));
    dialogBuilder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {

        @Override/*from w  w w. j  a va 2  s. c  o m*/
        public void onClick(DialogInterface dialog, int which) {
            // Nothing to do here...
        }
    });
    dialogBuilder.setNegativeButton(R.string.decline, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // Nothing to do here...

        }
    });

    dialog = dialogBuilder.create();

    dialog.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override
        public void onShow(DialogInterface dialogInterface) {
            final Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
            final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);

            positiveButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    RestClientHolder.getRestClient().upVoteEvent(dialog.getContext(), event,
                            new AsyncHttpResponseHandler() {

                                @Override
                                public void onFailure(int statusCode, Header[] headers, byte[] responseBody,
                                        Throwable error) {
                                    Log.i(TAG, "Failed to upvote event " + event.getId() + " cause: " + error);
                                }

                                @Override
                                public void onFinish() {
                                    dialog.dismiss();
                                }

                                @Override
                                public void onStart() {
                                    positiveButton.setEnabled(false);
                                    negativeButton.setEnabled(false);
                                }

                                @Override
                                public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
                                    Log.i(TAG, "Event " + event.getId() + " upvoted with success");
                                }

                            });
                }
            });

            negativeButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    RestClientHolder.getRestClient().downVoteEvent(dialog.getContext(), event,
                            new AsyncHttpResponseHandler() {

                                @Override
                                public void onFailure(int statusCode, Header[] headers, byte[] responseBody,
                                        Throwable error) {
                                    Log.i(TAG,
                                            "Failed to downvote event " + event.getId() + " cause: " + error);
                                }

                                @Override
                                public void onFinish() {
                                    dialog.dismiss();
                                }

                                @Override
                                public void onStart() {
                                    positiveButton.setEnabled(false);
                                    negativeButton.setEnabled(false);
                                }

                                @Override
                                public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
                                    Log.i(TAG, "Event " + event.getId() + " downvoted with success");
                                }

                            });
                }
            });

        }
    });

    return dialog;
}