Android Programming Tutorials

(Romina) #1

TUTORIAL 7


Menus and Messages


In this tutorial, we will add a EditText for a note to our details form and


restaurant model. Then, we will add an options menu that will display the


note as a Toast.


Step-By-Step Instructions..........................................................................


First, you need to have completed the previous tutorial. If you are


beginning the tutorials here, or if you wish to not use your existing work,


you can download a ZIP file with all of the tutorial results, and you can copy


the 06-Tabs edition of LunchList to use as a starting point.


Step #1: Add Notes to the Restaurant.................................................


First, our restaurant model does not have any spot for notes. Add a String


notes data member plus an associated getter and setter. Your resulting class


should look like:


package apt.tutorial;

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

public String getName() {
return(name);

57
Free download pdf