×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    53

    problem executing LBS application

    Hi

    I thk it is very easy for some of you to answer this but..iam still new to j2me.

    I want to see how LBS application works.and for that i got some sample code.

    But it's giving me some errors..though i have placed the the program at correct palce.

    Thanks
    ****************************************************

    C:\Documents and Settings\jb78\j2mewtk\2.5.2\apps\GPS\src\Location.java:116: cannot find symbol
    symbol : class loctest
    location: class Retriever
    private loctest midlet;
    ^
    C:\Documents and Settings\jb78\j2mewtk\2.5.2\apps\GPS\src\Location.java:120: cannot find symbol
    symbol : class loctest
    location: class Retriever
    public Retriever(loctest midlet)
    ^
    C:\Documents and Settings\jb78\j2mewtk\2.5.2\apps\GPS\src\Location.java:181: incompatible types
    found : javax.microedition.location.Location
    required: Location
    l = lp.getLocation(60);
    ^
    C:\Documents and Settings\jb78\j2mewtk\2.5.2\apps\GPS\src\Location.java:183: cannot find symbol
    symbol : method getQualifiedCoordinates()
    location: class Location
    c = l.getQualifiedCoordinates();
    ^
    4 errors
    com.sun.kvem.ktools.ExecutionException



    import javax.microedition.midlet.*;

    import javax.microedition.lcdui.*;

    import javax.microedition.location.*;


    public class Location extends MIDlet implements CommandListener
    {

    private Display display;

    private Form form;

    private Command cmdExit, cmdOK;

    private StringItem si;



    public Location()
    {



    display = Display.getDisplay(this);

    form = new Form("Location Api test");
    cmdExit = new Command("Exit", Command.EXIT, 5);

    cmdOK = new Command("OK", Command.OK, 1);

    si = new StringItem("Geo Location", "Click OK");

    form.append(si);

    form.addCommand(cmdOK);
    form.addCommand(cmdExit);

    form.setCommandListener(this);


    }



    public void startApp()
    {

    display.setCurrent(form);

    }





    public void pauseApp()
    {



    }



    public void destroyApp(boolean flag)
    {

    notifyDestroyed();

    }



    public void commandAction(Command c, Displayable d)
    {

    if (c == cmdOK)
    {

    Retriever ret = new Retriever(this);

    ret.start();



    }
    else if (c == cmdExit)
    {

    destroyApp(false);

    }

    }



    public void displayString(String string)
    {

    si.setText(string);

    }

    }



    class Retriever extends Thread
    {



    private loctest midlet;



    public Retriever(loctest midlet)
    {

    this.midlet = midlet;


    }



    public void run()
    {




    try
    {

    checkLocation();

    }
    catch (Exception ex)
    {

    ex.printStackTrace();

    midlet.displayString(ex.toString());

    }

    }



    public void checkLocation() throws Exception
    {

    String string;

    Location l;

    LocationProvider lp;

    Coordinates c;



    Criteria cr = new Criteria();

    cr.setHorizontalAccuracy(500);




    lp = LocationProvider.getInstance(cr);



    // Request the location, setting a one-minute timeout

    l = lp.getLocation(60);

    c = l.getQualifiedCoordinates();
    if (c != null)
    {

    // Use coordinate information

    double lat = c.getLatitude();

    double lon = c.getLongitude();

    string = "\nLatitude : " + lat + "\nLongitude : " + lon;



    }
    else
    {

    string = "Location API failed";

    }

    midlet.displayString(string);

    }

    }

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: problem executing LBS application

    Where is loctest class defined?
    That is the first thing which the compiler is complaining...

    Hartti

  3. #3
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    53

    Re: problem executing LBS application

    Hi Hartii

    Can u please suggest how can i change that.i am not very sure abt it..

    please help!!!

    Thanks

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: problem executing LBS application

    You need to include the loctest class in your MIDlet classes. How you do it depends of which IDE do you use.
    In general you should see the loctest class included in the MIDlet project in the IDEs project browser on the left of the screen.

    Hartti

  5. #5
    Registered User
    Join Date
    Dec 2004
    Posts
    369

    Re: problem executing LBS application

    looks to me like you took some source code and changed the midlet class name.
    and didnt do it on the entire file.
    from what i see loctest should be Location (the hint was the variable name "midlet" and Location extends midlet).

    so either go back to the original code and keep making the changes

    BR

  6. #6
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    53

    Re: problem executing LBS application

    Hi

    Thanks for your reply..

    Actually i just have one Midlet class,i do not have any more classes,and i have not changed the Midlet name as well...


    This application is about calculating the long. lati. and atti. for our location.

    What can i do next. can u explain

    Thanks
    Last edited by vin7805; 2008-05-07 at 09:47.

  7. #7
    Registered User
    Join Date
    Dec 2004
    Posts
    369

    Thumbs up Re: problem executing LBS application

    Quote Originally Posted by shaii View Post
    looks to me like you took some source code and changed the midlet class name.
    and didnt do it on the entire file.
    from what i see loctest should be Location (the hint was the variable name "midlet" and Location extends midlet).

    so either go back to the original code and keep making the changes

    BR
    the midlet name has been change i can see that very clearly
    by the decleration of:

    private loctest midlet;

    and the fact that your midlet name is "Location"
    and you said you only have one midlet....

    so i'de say to you replace all "loctest" with "Location"

    BR

  8. #8
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    53

    Re: problem executing LBS application

    Hello

    Many Thanks!!

    It solved that errors but still i am getting two errors

    can you please help me resolving that one as well..plz

    Thanks

    C:\Documents and Settings\jb78\j2mewtk\2.5.2\apps\GPS\src\Location.java:181: incompatible types
    found : javax.microedition.location.Location
    required: Location
    l = lp.getLocation(60);
    ^
    C:\Documents and Settings\jb78\j2mewtk\2.5.2\apps\GPS\src\Location.java:183: cannot find symbol
    symbol : method getQualifiedCoordinates()
    location: class Location
    c = l.getQualifiedCoordinates();
    ^
    2 errors
    com.sun.kvem.ktools.ExecutionException
    Build failed

  9. #9
    Registered User
    Join Date
    Dec 2004
    Posts
    369

    Re: problem executing LBS application

    yes i can....
    there is already a Location class with the location package you are using......

    so either change your midlet name to something else such MyLocation or LocationMidlet.

    or have the full path for the variable l, so that instade of "Location l;"
    write "javax.microedition.location.Location l;"

    but i would suggest renaming your midlet (first option).

    BR

  10. #10
    Regular Contributor
    Join Date
    Feb 2008
    Posts
    53

    Re: problem executing LBS application

    Hi shaii

    Many thanks!!!

    It works,but i am still getting some problem when i installed it on Nokia n95, its showing application not compaitable with phone.

    i dont know why its showing me that mess.when it perfectly run on emulator.

    can you plz check it once.

    I just need to ask you 1 more thing, as this application is to calcualte long and lat. what i can do next to view my current place.

    do i need to import map and should put this values on to it..?..or ?

    Thanks

  11. #11
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: problem executing LBS application

    My guess: Build the app for MIDP 2.0 not for MIDP 2.1

    (check the manifest and jad file for the MIDP version you are currently targeting and make the changes in the project settings in WTK - or whatever development environment you are using)

    Hartti

Similar Threads

  1. Problem compiling UI HelloCarbide Application
    By sbosio in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2007-11-15, 05:07
  2. Debugging application launch problem on-device?
    By thrust in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-07-11, 14:25
  3. Main Problem with Application Entrypoint
    By Rozik in forum Symbian
    Replies: 2
    Last Post: 2007-03-28, 19:34
  4. Possible problem with application launcher in Nokia 6681
    By dantifer in forum General Development Questions
    Replies: 0
    Last Post: 2005-12-15, 05:31
  5. Problem in Executing application on Series60 V1.2
    By mishrasaurabh in forum Symbian
    Replies: 0
    Last Post: 2004-11-04, 09:17

Posting Permissions

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