OK, so we have a plan for what we want the screen to look like. Let's start by adding the field to accept the bill amount into the application.
Add the following code to the TipCalcMainScreen
class as a data member.
protected EditField amount = new EditField();
Talk about baby steps! This one line didn't accomplish much, but a couple of things happened that need more explanation. First, you need to know a bit more about the EditField
class. It may seem obvious, but an EditField
is another class in the SDK that is designed to work with the MainScreen
class in order to provide standard functionality. As the name implies, an EditField
is meant to allow the user to enter text data.
Secondly, as you can see in the following screenshot, EditField
is underlined within Eclipse with a red squiggly line, which indicates that there is an error.
Hovering over the line shows a dialog with some suggestions about how to solve the problem...