In this exercise, you will use the debugger to look at the work you did in Exercise 3. This exercise demonstrates:
Using the working Notepadv3
, put breakpoints in the code at the
beginning of the onCreate()
, onPause()
,
onSaveInstanceState()
and onResume()
methods in the
NoteEdit
class (if you are not familiar with Eclipse, just
right click in the narrow grey border on the left of the edit window at the
line you want a breakpoint, and select Toggle Breakpoint, you
should see a blue dot appear).
Now start the notepad demo in debug mode:
Notepadv3
project and from the Debug menu
select Debug As -> Android Application.adb kill-server
, and then restart
Eclipse and try again.When you edit or create a new note you should see the breakpoints getting hit and the execution stopping.
Hit the Resume button to let execution continue (yellow rectangle with a green triangle to its right in the Eclipse toolbars near the top).
Experiment a bit with the confirm and back buttons, and try pressing Home and making other mode changes. Watch what life-cycle events are generated and when.
The Android Eclipse plugin not only offers excellent debugging support for your application development, but also superb profiling support. You can also try using Traceview to profile your application. If your application is running too slow, this can help you find the bottlenecks and fix them.