Android Dialog edit

A Basic Alert Dialog

AlertDialog.Builder builder = new AlertDialog.Builder(context);
//Set Title
builder.setTitle("Reset...")
        //Set Message
        .setMessage("Are you sure?")
        //Set the icon of the dialog
        .setIcon(drawable)
        //Set the positive button, in this case, OK, which will dismiss the dialog and do everything in the onClick method
        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                // Reset
            }
        });
AlertDialog dialog = builder.create();
//Now, any time you can call on:
dialog.show();
//So you can show the dialog.

Now this code will achieve this:

 

(Image source: WikiHow)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Table Of Contents
38 Dialog
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close