From the example of the book I am studying from
public static final Drink[] drinks = {
new Drink ("Latte", "A couple of espresso shots with steamed milk ",
R.drawable.latte),
new Drink ("Cappuccino", "Espresso, hot milk, and a steamed milk foam",
R.drawable.cappuccino),
new Drink ("Filter", "Highest quality beans roasted and brewed fresh",
R.drawable.filter)
};
First we have this method returning an array in the Drink class and in an activity we are supposed to retrieve data from it by using an adapterarray and here's that code:
ArrayAdapter<Drink> listAdapter= new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, Drink.drinks);
ListView listDrinks = (ListView) findViewById(R.id.list_drinks);
listDrinks.setAdapter(listAdapter);
What I don't understand is why does this ArrayAdapter only retrieve the name of the drinks rather than the whole details in a list view? I can't see anywhere in the code where we specify only to retrieve the names.