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.abid_mujtaba.bitcoin.tracker.MainActivity.java

private void change_sampling_window() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Choose Sampling window");
    builder.setSingleChoiceItems(window_strings, mChosenWindowIndex, windowListener);

    windowDialog = builder.create();
    windowDialog.show();//from w  w w  .j  a va  2s .c om
}

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);//from  w  w  w.j av  a2s . com
    builder.setCancelable(false);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:net.dahanne.android.regalandroid.tasks.LoginTask.java

private void showAlert(String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(R.string.problem).setMessage(message).setPositiveButton(R.string.ok,
            new DialogInterface.OnClickListener() {
                @Override/*w  w  w. j av  a 2 s .  com*/
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.lepin.activity.AddNewCarActivity.java

/**
 * ?/*from w w  w .  j  ava2s.  c om*/
 */
protected void choicePeoPleNumber() {
    AlertDialog.Builder builder = new AlertDialog.Builder(AddNewCarActivity.this);
    builder.setTitle(R.string.pick_details_total_people).setItems(pepNumArry,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    addNum.setText(pepNumArry[which]);
                }
            });
    builder.create().show();
}

From source file:edu.mit.mobile.android.locast.accounts.AuthenticatorActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_PROGRESS:

        final ProgressDialog dialog = new ProgressDialog(this);
        dialog.setMessage(getText(R.string.login_message_authenticating));
        dialog.setIndeterminate(true);//from  www .  ja v a 2s  .c om
        dialog.setCancelable(true);
        dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                Log.i(TAG, "dialog cancel has been invoked");
                if (mAuthenticationTask != null) {
                    mAuthenticationTask.cancel(true);
                    mAuthenticationTask = null;
                    finish();
                }
            }
        });
        return dialog;

    case DIALOG_SET_BASE_URL:

        final EditText baseUrl = new EditText(this);
        baseUrl.setText(getString(R.string.default_api_url));
        final AlertDialog.Builder db = new AlertDialog.Builder(this);
        return db.create();

    default:
        return null;
    }
}

From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java

public static void displayPromptForEnablingGPS(final Activity activity) {

    final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
    final String message = "Do you want open GPS setting?";

    builder.setMessage(message).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface d, int id) {
            activity.startActivity(new Intent(action));
            d.dismiss();/* w ww .j a  va 2  s. c  o m*/
        }
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface d, int id) {
            d.cancel();
        }
    });
    builder.create().show();
}

From source file:net.alchemiestick.katana.winehqappdb.SearchView.java

private Dialog about_dialog() {
    String msg = "Copyright May 25th 2012 by Rene Kjellerup (aka Katana Steel) and Alchemiestick.\n\n";
    msg += "WineHQ Appdb Search is released under GPLv3 or later. It uses images from WINE project under LGPLv2 or later ";
    msg += "see license:\nhttp://www.gnu.org/licenses/\nfor more infomation about the licenses.\n\n";
    msg += "Souce code for the program can be obtained at\nhttps://github.com/Katana-Steel/winehqappdb\nand choose ";
    msg += "the apropriate release tag for the the version you are running.";
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("About").setMessage(msg).setCancelable(true).setNeutralButton("Ok",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();/*from www  . java  2s . c  om*/
                }
            });
    return builder.create();
}

From source file:com.springsource.greenhouse.WebOAuthActivity.java

private void displayAppAuthorizationError(String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(message);/*w  w w .ja va  2  s  . c o  m*/
    builder.setCancelable(false);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            signOut();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.abid_mujtaba.bitcoin.tracker.MainActivity.java

private void change_sampling_interval() // Method called when the user clicks the "Change Interval" button on the ActionBar menu
{
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Choose Sampling Interval");
    builder.setSingleChoiceItems(intervals, mChosenIntervalIndex, intervalListener); // We set items in the dialog as well as the item to be shown chosen

    intervalDialog = builder.create();
    intervalDialog.show();//  w  w w .j  a  v a  2 s .c  o m
}

From source file:it.mb.whatshare.Dialogs.java

/**
 * Shows a dialog telling the user what to do before the QR code scanner is
 * displayed, and starts the QR code activity.
 * //  www  . j  a v  a2 s .  c om
 * @param activity
 *            the caller activity
 */
public static void pairInboundInstructions(final FragmentActivity activity) {
    DialogFragment dialog = new PatchedDialogFragment() {
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            AlertDialog.Builder builder = getBuilder(activity);
            View layout = View.inflate(getContext(), R.layout.pair_inbound_instructions, null);
            builder.setView(layout);
            ((TextView) layout.findViewById(R.id.instructions))
                    .setText(getResources().getString(R.string.new_inbound_instructions));
            builder.setPositiveButton(android.R.string.ok, new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
                    intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE", "QR_CODE_MODE");
                    getActivity().startActivityForResult(intent, MainActivity.QR_CODE_SCANNED);
                }
            });
            return builder.create();
        }
    };
    dialog.show(activity.getSupportFragmentManager(), "instruction");
}