×

Discussion Board

Results 1 to 2 of 2

Thread: need help

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    32

    need help

    dear sir
    iam new in j2me, i want to display my current gps coordinate every 5 second, i searched the internet and i have found this code

    // Set criteria for selecting a location provider:
    // accurate to 500 meters horizontally
    Criteria cr= new Criteria();
    cr.setHorizontalAccuracy(500);

    // Get an instance of the provider
    LocationProvider lp= LocationProvider.getInstance(cr);

    // Request the location, setting a one-minute timeout
    Location l = lp.getLocation(50);
    Coordinates c = l.getQualifiedCoordinates();

    if(c != null ) {
    // Use coordinate information
    double lat = c.getLatitude();
    double lon = c.getLongitude();
    }

    my question is where to put this code
    i have created a textfield then i right click on it and choose go to source
    and i put the above code after :

    textField = new TextField("textField", null, 32, TextField.ANY);
    // write post-init user code here

    but it give error

    could any one help me where to put the above gps code
    with best regard

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: need help

    Hello souhir,

    for reference, you might want to check this Location API related Java code example available in Forum Nokia Wiki: Java ME Location API

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×