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:com.mono.applink.Twitter.java

/** Called when the activity is first created. */
@Override// w w w . jav  a 2s.com
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final String url = getIntent().getData().toString();

    if (url.contains("twitter.com") && !url.contains("status") && !url.contains("direct_messages")
            && !url.contains("user_spam_reports") && !url.contains("account") && !url.contains("settings"))//Just if it is a link of a user profile
    {
        new TwitterUser().execute();
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("Sorry, but this type of link is not currently supported");
        builder.setOnCancelListener(new OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                finish();
            }
        });
        builder.setPositiveButton("Open in Browser", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Intent i = new Intent();
                i.setAction("android.intent.action.VIEW");
                i.addCategory("android.intent.category.BROWSABLE");
                i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                i.setData(Uri.parse(url));
                startActivity(i);
                finish();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    }
}

From source file:com.chaosinmotion.securechat.fragments.OnboardingForgotPassword.java

private void doResetPassword() {
    try {/* www. j a va2s  .c om*/
        JSONObject d = new JSONObject();
        d.put("username", username.getText().toString());
        SCNetwork.get().request("login/forgotpassword", d, this, new SCNetwork.ResponseInterface() {
            @Override
            public void responseResult(SCNetwork.Response response) {
                if (response.isSuccess()) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                    builder.setMessage(R.string.reset_password_message);
                    builder.setTitle(R.string.reset_password_title);
                    builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            wizardInterface.goBack();
                        }
                    });
                    builder.show();
                }
            }
        });
    } catch (JSONException ex) {
    }
}

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

private void show_confirm() {
    DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
        @Override// ww w. java2  s . com
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case DialogInterface.BUTTON_POSITIVE:
                // Yes button clicked save and clear
                Make_delete_request(hack_id);

                break;
            case DialogInterface.BUTTON_NEGATIVE:
                // No button clicked do nothing
                break;
            }
        }
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
            .setNegativeButton("No", dialogClickListener).show();
}

From source file:com.sorin.mediync.volley.PatientListView.java

private void showErrorDialog() {
    mInError = true;/*from ww w .ja  v  a  2  s . c  om*/

    AlertDialog.Builder b = new AlertDialog.Builder(PatientListView.this);
    b.setMessage("Error occured");
    b.show();
}

From source file:com.github.irib_examples.Act_NetworkListView.java

private void showErrorDialog() {
    mInError = true;/*from   w  w  w  . j  a va  2  s .  co m*/

    AlertDialog.Builder b = new AlertDialog.Builder(Act_NetworkListView.this);
    b.setMessage("Error occured");
    b.show();
}

From source file:com.springsource.greenhouse.events.sessions.EventSessionRatingActivity.java

private void showResult(String result) {
    //      Toast.makeText(this, result, Toast.LENGTH_LONG).show();
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(result);
    builder.setCancelable(false);/*w  w w .j  a v  a 2 s.c  o  m*/
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.volley.demo.ExampleNetworkListView.java

private void showErrorDialog() {
    mInError = true;//from w ww  .ja v a 2s .  c o m

    AlertDialog.Builder b = new AlertDialog.Builder(ExampleNetworkListView.this);
    b.setMessage("Error occured");
    b.show();
}

From source file:com.springsource.greenhouse.twitter.TweetDetailsActivity.java

private void showRetweetDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Are you sure you want to Retweet?").setCancelable(false)
            .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    retweet();//from   w w w  .j av  a 2  s .  c  o  m
                }
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:it.simoneloru.ctmdroid.activities.TimetableActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
    alertBuilder.setMessage(R.string.unknowHost);
    alertBuilder.setTitle(android.R.string.dialog_alert_title);
    alertBuilder.setIcon(android.R.drawable.ic_dialog_alert);
    alertBuilder.setPositiveButton(android.R.string.ok, null);
    AlertDialog eulaMsg = alertBuilder.create();
    return eulaMsg;
}

From source file:com.outsystemscloud.andrevieira.secureDevice.java

/**
 * Builds and shows a native Android alert with given Strings
 * @param message           The message the alert should display
 * @param buttonLabel       The label of the button
 * @param callbackContext   The callback context
 *//*from   w  w  w. j a v  a2  s .  co  m*/
private synchronized void alert(final String message, final String buttonLabel) {
    final CordovaInterface cordova = this.cordova;
    final Activity activity = cordova.getActivity();

    Runnable runnable = new Runnable() {
        public void run() {

            AlertDialog.Builder dlg = createDialog(cordova);
            dlg.setMessage(message);
            dlg.setCancelable(true);
            dlg.setPositiveButton(buttonLabel, new AlertDialog.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    System.exit(0);
                }
            });
            dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
                public void onDismiss(final DialogInterface dialog) {
                    System.exit(0);
                }
            });
            changeTextDirection(dlg);
        };
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}