Android Programming Tutorials

(Romina) #1
Adding a List

}

adapter.add(r);
}
};
}

The magic value android.R.layout.simple_list_item_1 is a stock layout for a


list row, just displaying the text of the object in white on a black


background with a reasonably large font. In later tutorials, we will change


the look of our rows to suit our own designs.


If you then add a few restaurants via the form, it will look something like


this:


Figure 11. Our LunchList with a few fake restaurants added

Extra Credit.................................................................................................


Here are some things you can try beyond those step-by-step instructions:


35
Free download pdf