0

I only wish Nokia documentation was more helpful. Its search on developer documentation totally sucks.

public class UpdateJourney extends Form implements CommandListener, Runnable {
    private LocationProvider myLocation;
    private Criteria myCriteria;
    private Location myCurrentLocation;

    private HomeScreen helloScreen;
    private Command exitCommand;

    private Thread getLocationThread = new Thread(this);;

    public UpdateJourney(HomeScreen helloScreen) {
        super("Taxeeta");
        this.helloScreen = helloScreen;
        getLocationThread.start();
    }


    public void run() {
        myCriteria = new Criteria();
        myCriteria.setHorizontalAccuracy(500);
        try {
            myLocation = LocationProvider.getInstance(myCriteria);
            myCurrentLocation = myLocation.getLocation(60);
        } catch (LocationException e) {
            e.printStackTrace();
            System.out
                    .println("Error : Unable to initialize location provider");
            return;
        } catch (InterruptedException e) {
            e.printStackTrace();
            System.out.println("Error: Waited enough for location to return");
            return;
        }
        System.out.println("Location returned Lat:"
                + myCurrentLocation.getQualifiedCoordinates().getLatitude()
                + " Lng:"
                + myCurrentLocation.getQualifiedCoordinates().getLongitude());
        String helloText = new String("Location returned Lat:"
                + myCurrentLocation.getQualifiedCoordinates().getLatitude()
                + " Lng:"
                + myCurrentLocation.getQualifiedCoordinates().getLongitude());
        super.append(helloText);

        exitCommand = new Command("Location returned Lat:"
                + myCurrentLocation.getQualifiedCoordinates().getLatitude()
                + " Lng:"
                + myCurrentLocation.getQualifiedCoordinates().getLongitude(),
                Command.EXIT, 1);
        addCommand(exitCommand);
        setCommandListener(this);

    }

}
Siddharth
  • 9,349
  • 16
  • 86
  • 148

1 Answers1

1

do you mean not showing from this command?:

System.out.println("Location returned Lat:"
+ myCurrentLocation.getQualifiedCoordinates().getLatitude()
+ " Lng:"
+ myCurrentLocation.getQualifiedCoordinates().getLongitude());

It's not showing to phone screen. Instead it will show on console (IDE / debugging).

to showing text on Form.. you need to use somethings like:

form.addComponent(new Label("hi...");

hope it helps.

mico wendy
  • 46
  • 3