HelloCW
HelloCW

Reputation: 2255

Can AlertDialog display a message with checkbox dialog?

I hope to get a dialog just like a.png, but the following code can't create the UI just like a.png. How can I do? Thanks!

a.png

AlertDialog.Builder builder = new Builder(this);
builder.setMessage("The operation will spend long time!");
builder.setTitle(getString(R.string.Warning));
builder.setMultiChoiceItems(new String[] { "Don't display the message again" }, null, null);
builder.setPositiveButton(getString(R.string.OK), new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
    }
});

builder.create().show();    

Upvotes: 1

Views: 980

Answers (1)

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132982

Can AlertDialog display a message with checkbox dialog?

for showing any View in AlertDialog you should need to create custom layout for Dialog screen instead of using default see below example for creating custom AlertDialog :

Android prompt user input dialog example

Customize AlertDialog

Upvotes: 3

Related Questions