Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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();
Source by developer.android.com #
 
PREVIOUS NEXT
Tagged: #android #alertdialog #setSingleChoiceItems
ADD COMMENT
Topic
Name
1+3 =