Example usage for android.app AlertDialog.Builder create

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

Introduction

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

Prototype

public void create() 

Source Link

Document

Forces immediate creation of the dialog.

Usage

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  ww.j  av  a2  s. com*/
                }
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.sakisds.icymonitor.fragments.graph.GraphContainerFragment.java

/**
 * Shows an error dialog//w  ww  . jav  a2s.  com
 *
 * @param error
 */
protected void showErrorDialog(int error) {
    AlertDialog.Builder dlgAlert = new AlertDialog.Builder(getActivity());
    dlgAlert.setMessage(getResources().getString(error));
    dlgAlert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    dlgAlert.setCancelable(true);
    dlgAlert.create().show();
}

From source file:nl.terr.tabweave.TabWeave.java

public AlertDialog createAlertDialog(Context context, String sTitle, String sMessage) {
    AlertDialog.Builder builder = new AlertDialog.Builder(TabWeave.this);
    builder.setTitle(sTitle).setMessage(sMessage).setCancelable(false)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                }/*from  w ww  .jav a  2  s .c o m*/
            });
    AlertDialog alert = builder.create();

    return alert;
}

From source file:org.webpki.mobile.android.proxy.BaseProxyActivity.java

public void showAlert(String message) {
    AlertDialog.Builder alert_dialog = new AlertDialog.Builder(this).setMessage(message).setCancelable(false)
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // Close the dialog box and do nothing
                    dialog.cancel();/*from w  w  w.j a v  a 2 s . c om*/
                }
            });

    // Create and show alert dialog
    alert_dialog.create().show();
}

From source file:org.xbmc.android.remote.presentation.controller.AbstractController.java

protected void showDialog(final AlertDialog.Builder builder) {
    builder.setCancelable(true);/*from   w w w.j av  a2s. c o m*/
    builder.setNegativeButton("Close", new OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
            mDialogShowing = false;
            //            ConnectionManager.resetClient();
        }
    });

    mActivity.runOnUiThread(new Runnable() {
        public void run() {
            final AlertDialog alert = builder.create();
            try {
                if (!mDialogShowing) {
                    alert.show();
                    mDialogShowing = true;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:com.github.rutvijkumar.twittfuse.TwitterUtil.java

public void confirmRetweet(final Tweet tweet, final ImageButton rtAction, final TextView rtCount,
        final boolean hideZero) {

    if (!tweet.isRetweeted()) {

        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setTitle("Retweet this to your followers?");
        builder.setPositiveButton("Retweet", new DialogInterface.OnClickListener() {
            @Override//from w  w  w .  j a va2s.co m
            public void onClick(DialogInterface dialog, int whichButton) {
                if (!Util.isNetworkAvailable(activity)) {
                    Util.showNetworkUnavailable(activity);
                }
                doReTweet(tweet, rtAction, rtCount, hideZero);

            }

        });
        builder.setNegativeButton("Cancel", null);
        builder.create().show();
    }
}

From source file:de.evilbrain.sendtosftp.Main.java

public String serverListGetActive() {

    // Get selected Radio Button
    int selectedId = serverList.getCheckedRadioButtonId();

    // Get text from radio-button
    RadioButton actualradioButton = (RadioButton) findViewById(selectedId);
    if (actualradioButton == null) {
        AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
        dlgAlert.setTitle("Select an Server");
        dlgAlert.setMessage("Please select an server from the list");
        dlgAlert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {

            }//from  w  w  w .ja v a 2 s  .c om
        });
        dlgAlert.setCancelable(true);
        dlgAlert.create().show();

        return null;
    }

    return actualradioButton.getText().toString();
}

From source file:net.reichholf.dreamdroid.activities.TimerListActivity.java

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    mTimer = mMapList.get((int) id);

    CharSequence[] actions = { getText(R.string.edit), getText(R.string.delete) };

    AlertDialog.Builder adBuilder = new AlertDialog.Builder(this);
    adBuilder.setTitle(R.string.pick_action);
    adBuilder.setItems(actions, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case 0:
                editTimer(mTimer, false);
                break;
            case 1:
                deleteTimerConfirm();/*from ww w . j  av a 2  s .  c  om*/
                break;
            }
        }
    });

    AlertDialog alert = adBuilder.create();
    alert.show();
}

From source file:edu.missouri.bas.activities.AdminManageActivity.java

private Dialog buildDialog1(Context context, String str) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(false);// w ww  . j a  v a  2  s.  c o m
    builder.setTitle("Confirm");
    builder.setMessage(str);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            setHints();
        }
    });
    return builder.create();
}