I am trying to use setAdapter to populate a dialog list. My array
adapter is getting populated with the correct values and is assigned
to the alert dialog with setAdapter fine.

The dialog knows that it should be displaying 3 value and shows a list
with 3 values. However the list displayed in the alert had 3 empty
lines. They are just blank without the text values on them.

What am I doing wrong here? Thanks in advance.

final ArrayList<String> vehicleList = new ArrayList<String>();
vehicleList.add("List entry 1");
vehicleList.add("List entry 2");
vehicleList.add("List entry 3");
ArrayAdapter<String> vehicleAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, vehicleList);


                    AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    builder.setTitle("Choose vehicle");
                    //builder.setItems(items, new 
DialogInterface.OnClickListener()
{
                    builder.setAdapter(vehicleAdapter, new
DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int item) {
                            Toast.makeText(getApplicationContext(), "Item 
selected",
Toast.LENGTH_SHORT).show();
                        }
                    });
                    AlertDialog alert = builder.create();
                    alert.show();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to