Siddhesh
Siddhesh

Reputation: 90

How can I add Arraylist in the alert dialog?

I created a Arraylist containing all contacts of my mobile and I want to put this Arraylist inside the alert dialog.How can i do this?please reply me

Upvotes: 0

Views: 1040

Answers (1)

Ted
Ted

Reputation: 126

 AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
     builder.setTitle("Contacts");
     builder.setMessage(your_arraylist.toString());
     builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
     builder.show();

Upvotes: 1

Related Questions