Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

alertdialog show in android

  AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(getResources().getString(R.string.do_you_really_want_to_signout));
        builder.setTitle(getResources().getString(R.string.sign_out));
        builder.setCancelable(false);
        builder.setNegativeButton(getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });
        builder.setPositiveButton(getResources().getString(R.string.sure), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(AccountActivity.this, R.string.log_out_success,
                        Toast.LENGTH_LONG).show();
               
            }
        });

        AlertDialog alert = builder.create();
        alert.show();
Comment

android alertdialog setSingleChoiceItems

// 1. Instantiate an AlertDialog.Builder
AlertDialog.Builder builder = new AlertDialog.Builder(context);

// 2. Call various setter methods to set the dialog characteristics
builder.setTitle("My Title");
builder.setMessage("My Message");
builder.setPositiveButton("OK", (dialog, which) -> { /* ... */ });
builder.setNegativeButton("Cancel", (dialog, which) -> { /* ... */ });

// 3. Instantiate the AlertDialog
AlertDialog dialog = builder.create();

// 4. Show the AlertDialog
dialog.show();
Comment

PREVIOUS NEXT
Code Example
Java :: findviewbyid java android 
Java :: java selenium send keys numbers 
Java :: android time 
Java :: key listener java 
Java :: how to get a section of an array in java 
Java :: priority queue java comparator lambda 
Java :: how to convert a collection to array in java 
Java :: byte array to base64 string 
Java :: check instance of java 
Java :: convert bytebuffer to string 
Java :: get last index of array java 
Java :: spigot send player action bar message 1.8 
Java :: how to use scanners in java 
Java :: AmazonS3ClientBuilder 
Java :: How to close jframe on click of button 
Java :: jframe in java 
Java :: date difference in minutes java 
Java :: java format use same value multiple times 
Java :: java stream limit items 
Java :: android studio pass value to another activity 
Java :: Who made java ? 
Java :: how to get last element of array java 
Java :: split string regex java 
Java :: split method in java 
Java :: sum of a list using for loop in dart 
Java :: what does static mean java 
Java :: find first element of list java 
Java :: how to modify string in java 
Java :: android html to bitmap 
Java :: fill two dimensional array 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =