Android Programming Tutorials

(Romina) #1
A Fancier Form

Figure 9. Adding radio buttons

Step #3: Update the Model..................................................................


Right now, our model class has no place to hold the restaurant type. To


change that, modify LunchList/src/apt/tutorial/Restaurant.java to add in a


new private String type data member and a getter/setter pair, like these:


public String getType() {
return(type);
}

public void setType(String type) {
this.type=type;
}

When you are done, your restaurant class should look something like this:


package apt.tutorial;

public class Restaurant {
private String name="";
private String address="";

23
Free download pdf