Time for action - building the fruit menu
For the Four Buckets 'o Fruit menu, we're going to need a
ListAdapter implementation to render the
FruitItem objects into the
fruit_item.xml layout resources. We'll also need a layout resource for the
GridView which we will load in our new
- Create a new class named
BaseAdapterin the root package of the project.
FruitAdapterneeds to hold and represent an array of
FruitItemobjects. Implement the class using the same structure as the
- In the
ListAdapter.getViewmethod, set the label and icon as defined in the
FruitItem item = items[index]; TextView text = ((TextView)view.findViewById(R.id.text)); ImageView image = ((ImageView)view.findViewById(R.id.icon)); ...