Show list in AlertDialog
<p>I am using an alert dialog that shows a menu on the beginning of the app, I want the dialog to show me 2 values which are "name"s from an object, here is the code of the alert dialog:</p>

<pre><code>public void showDialog() {

    EntityType en = new EntityType();
    ArrayList array = ApplicationController.entities;

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Pick one");
    builder.setItems(array, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // I want to write my code here
        }
    });

    builder.show();
}
</code></pre>

<p><code>EntityType</code> is my object that contain a string "name" and <code>ApplicationController.entities</code> contains the array</p>