Troubleshooting guide

208
BlackBerry Java Development Environment Development Guide
}
// Constructors. -------------------------------------------------------------
public GPSDemo() {
// Used by waypoints; represents the time since the last waypoint.
_startTime = System.currentTimeMillis();
_altitudes=new float[GRADE_INTERVAL];
_horizontalDistances=new float[GRADE_INTERVAL];
_messageString= new StringBuffer();
MainScreen screen = new GPSDemoScreen();
screen.setTitle(new LabelField(_resources.getString(GPSDEMO_TITLE),
LabelField.USE_ALL_WIDTH));
_status = new EditField();
screen.add(_status);
// try to start the GPS thread that listens for updates
if ( startLocationUpdate() ) {
startServerConnectionThread(); // if successful, start the thread that
communicates with the server
}
// Render our screen.
pushScreen(screen);
}
/* Update the GUI with the data just received.
*/
private void updateLocationScreen(final String msg) {
invokeLater(new Runnable() {
public void run() {
_status.setText(msg);
}
});
}
// Menu items. ---------------------------------------------------------------
// Cache the markwaypoint menu item for reuse.
private MenuItem _markWayPoint = new MenuItem(_resources,
GPSDEMO_MENUITEM_MARKWAYPOINT, 110, 10) {
public void run() {
GPSDemo.this.markPoint();
}
};
// Cache the view waypoints menu item for reuse.
private MenuItem _viewWayPoints = new MenuItem(_resources,
GPSDEMO_MENUITEM_VIEWWAYPOINTS, 110, 10) {
public void run() {
GPSDemo.this.viewPreviousPoints();
}
};
// Cache the options menu item for reuse.
private MenuItem _options = new MenuItem(_resources, GPSDEMO_MENUITEM_OPTIONS, 110, 10)
{
public void run()
{
GPSDemo.this.viewOptions();