0

我只希望诺基亚文档更有帮助。它对开发人员文档的搜索完全糟糕。

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);

    }

}
4

1 回答 1

1

你的意思是不显示从这个命令?:

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

它没有显示在手机屏幕上。相反,它将显示在控制台(IDE / 调试)上。

要在 Form.. 上显示文本,您需要使用以下内容:

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

希望能帮助到你。

于 2013-12-03T20:07:08.310 回答