Android AlertDialog - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AlertDialog class.

This code example shows how to use the following methods: setButton, setMessage, setTitle, dismiss, isShowing
            dialog = new AlertDialog.Builder(context)
                    .setPositiveButton(android.R.string.ok, disconnectListener)
                    .setNegativeButton(android.R.string.cancel, null)
                    .create();
        } else { 
            if (dialog.isShowing()) {
                dialog.dismiss();
            } 
            // use disconnectListener for the correct profile(s) 
            CharSequence okText = context.getText(android.R.string.ok);
            dialog.setButton(DialogInterface.BUTTON_POSITIVE,
                    okText, disconnectListener);
        } 
        dialog.setTitle(title);
        dialog.setMessage(message);
        dialog.show();
        return dialog;
    } 
 
    // TODO: wire this up to show connection errors... 
    static void showConnectingError(Context context, String name) {
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setTitle, setCancelable, setOnCancelListener, show, setIndeterminate
This code example shows how to use the following methods: setTitle, setIndeterminate
    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Bundle args = getArguments();
        String title = args.getString(ARG_TITLE);
 
        ProgressDialog dialog = new ProgressDialog(getActivity());
        dialog.setIndeterminate(true);
        dialog.setTitle(title);
 
        return dialog;
    } 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setTitle, setCancelable, setIndeterminate, setMessage
 
    @Override 
    protected Dialog onCreateDialog(int id) {
        switch (id) {
            case DIALOG1_KEY: {
                ProgressDialog dialog = new ProgressDialog(this);
                dialog.setTitle("Indeterminate");
                dialog.setMessage("Please wait while loading...");
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                return dialog;
            } 
            case DIALOG2_KEY: {
                ProgressDialog dialog = new ProgressDialog(this);
                dialog.setMessage("Please wait while loading...");
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                return dialog;
            } 
        } 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getWindow, setCancelable, setCanceledOnTouchOutside, show
    public void showOptionDialogInternal(AlertDialog dialog) {
        final IBinder windowToken = KeyboardSwitcher.getInstance().getKeyboardView()
                .getWindowToken(); 
        if (windowToken == null) return;
 
        dialog.setCancelable(true);
        dialog.setCanceledOnTouchOutside(true);
 
        final Window window = dialog.getWindow();
        final WindowManager.LayoutParams lp = window.getAttributes();
        lp.token = windowToken;
        lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
        window.setAttributes(lp);
        window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
 
        mOptionsDialog = dialog;
        dialog.show();
    } 
 
    @Override 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android AlertDialog Questions & Answers:

Other Android AlertDialog Examples

0:	AlertDialog alertDialog = new AlertDialog.Builder(
1:							AlertDialogActivity.this).create();
2:

Read More

7:				// device doesn't support flash
8:				// Show alert message and close the application
9:				AlertDialog alert = new AlertDialog.Builder(MainActivity.this)
10:						.create();
11:				alert.setTitle("Error");

Read More

17:		public void showAlertDialog(Context context, String title, String message,
18:				Boolean status) {
19:			AlertDialog alertDialog = new AlertDialog.Builder(context).create();
20:	
21:			// Setting Dialog Title

Read More

See Code Examples for Android AlertDialog Methods: