We will use the Eclipse debugger, set breakpoints, and inspect class members in the running application to observe what is going on inside this example. The use of the debugger with Android is described in Chapter 5. If you have not used a debugger before, don’t worry: we will use a limited set of debugging capabilities here to observe a program that works correctly. Just follow the steps in this section and let the debugger show you what is happening.
First, we will set a breakpoint where we want to start observing what is happening inside the application. To set a breakpoint, double-click on the left margin of the view that shows the program code in Eclipse. A blue dot will appear. If you change your mind and decide not to insert a breakpoint, double-click again on the blue dot, and it will disappear.
All we want is to stop execution of the program at the point
where we want to start inspecting what happens to the members of this
instance of the
dialing class. To
do this, set a breakpoint on line 21 of the program. You can tell
which line you are on by clicking a line in the program. In the status
bar at the bottom of the Eclipse window, you will see two numbers
separated by a colon. The first number is the line number where you
just clicked, and the second number is the character position on that
line where the insertion point is right now.
Start the application with the debugger by selecting Run → Debug, and when the “Debug as” dialog ...