0
A simple way to do this is to use the Dialog setItems method, from it you arrow your list, and it is loaded automatically in the Dialog.
Example:
final CharSequence[] cores = {"Azul", "Preto", "Verde"};
AlertDialog.Builder builder = new AlertDialog.Builder(CONTEXT);
builder.setTitle("Selecione uma Cor");
builder.setItems(cores, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int selecionado) {
Toast.makeText(getActivity(), "Cor Selecionada: " + cores[selecionado],
Toast.LENGTH_SHORT).show();
}
});
builder.create().show();
Note: The context would be an instance of your Activity, if you are running inside an Activity, you can use this;