×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    80

    need assistance - error starting Location Thread

    Hi,
    I'm trying to use the Wiki example "Java ME Location API"
    I use NetBeans 6.1/S60 5th Edition SDK v1.0.

    However I get an error during coding that can't understand.
    It looks like this NetBeans 6.1 compiler is different than thier compiler.
    The code parts look like this:
    ==============================

    public class KeyCanvas extends MIDlet implements CommandListener {
    private Retriver ret;
    ..
    public void startApp() throws MIDletStateChangeException {

    // Start GPS Lccation Retriver:
    ret = new Retriver(this); <--- ERROR: Cannot find symbol. symbol: Constructor Retriver(KeyCanvas)
    ret.start(); location: Class KeyCanvas.Retriver
    ...
    class Retriver extends Thread {}

    private KeyCanvas midlet;
    public void Retriver (KeyCanvas midlet){ <---- In the Nokia example they did'nt need the void declaration
    this.midlet = midlet;
    }

    public void run()
    {
    try
    {
    while (true) {
    checkLocation();
    Thread.sleep(GPSupdateTimer);
    }
    } catch (Exception ex)
    {ex.printStackTrace();

    }
    }
    Thank's in advance.
    /Per

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: need assistance - error starting Location Thread

    You've broken the code by adding that "void". That should be the constructor (the one it can't find), but it isn't, because you've added a return type. Constructors don't have a return type.

    Double check that you have the code correctly.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    80

    Re: need assistance - error starting Location Thread

    Thanks's Grahan,

    When I remove the "void" item it is the same code as in the example.
    However, NetBeans now declare an Error for these lines, stating:

    ..
    // Start GPS Lccation Retriver :
    ret = new Retriver(this); <--- ERROR Cannot find symbol.
    ret.start(); symbol: Retriver(KeyCanvas)
    .. location: class KeyCanvas.Retriver

    public Retriver (KeyCanvas midlet){ <-----ERROR Invalid method declaration; return type required
    this.midlet = midlet;
    }

    I understand that I need to understand this better, but how should this method be declared and why do this differ from the example?

    BR
    /Per
    Last edited by d-safety; 2009-06-13 at 21:16. Reason: missed the first error message

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: need assistance - error starting Location Thread

    I suggest you copy and paste the code from the wiki again.

    Looking back at the code you posted, I see:

    Code:
    class Retriver extends Thread {}
    This should not have the "}" on the end.

    Graham.

  5. #5
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    80

    Re: need assistance - error starting Location Thread

    Graham,

    1 Mega Thank you's to you!

    Best regards
    Per

Similar Threads

  1. Epoc is constantly crashing
    By elviin in forum Symbian Tools & SDKs
    Replies: 34
    Last Post: 2009-10-10, 21:24
  2. Thread
    By Kalderas in forum Symbian
    Replies: 4
    Last Post: 2003-08-14, 15:02
  3. Can't start thread function
    By liuhoihing in forum Symbian
    Replies: 0
    Last Post: 2003-05-05, 06:35

Posting Permissions

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