×

Discussion Board

Results 1 to 8 of 8

Threaded View

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    22

    [moved] a code snippet example. i ask question about it

    Helo. i write the belowing code. This code runs correctly in my application. i want to ask this. "speed" and "course" variables on this code returns "NAN". Where do i make wrong?
    The second question is that : the location updates become once in a minute, but i want to update once in 5-10 second. Is it possible ? Thanks.

    Code:
    public void Connection () throws LocationException
        {
            if(istracking==false)
            {
                istracking=true;
                screen.setCurrent(finf);
                finf.append("Connecting......");
                    cr=new Criteria();
                    cr.setHorizontalAccuracy(25);
                    provider=LocationProvider.getInstance(cr);
                    if(provider!=null)
                      provider.setLocationListener(this,-1,-1,-1);
             }
            
        }
        
    public void locationUpdated(LocationProvider provider, Location location)
         {
            upDate t=new upDate();
            t.start();
         }
    
        public void providerStateChanged(LocationProvider provider, int newState) {
        }
    
        
        public class upDate extends Thread
        {        
            public void run()
            {
               
                try
                {
                    loc=provider.getLocation(60);
                    if(loc.isValid())
                    {
                        String s="";
                        finf.deleteAll();
                        coor=loc.getQualifiedCoordinates();
                         double lt=coor.getLatitude();
                        double lon=coor.getLongitude();
                        float course=loc.getCourse();
                        double speed=loc.getSpeed();
                        long time=loc.getTimestamp();
                        
                        s="Langitude: "+lt+"\\nLongitute: "+lon+
                        "Course: "+course+"\Speed : "+speed+"\nTime: "+time;
                        finf.append(s);
                        
                    }
                }
                catch(Exception ex)
                {
                }
          }
    Last edited by ltomuta; 2008-11-10 at 07:54. Reason: Added code formating tags

Similar Threads

  1. [moved] error in code
    By _c_ in forum Symbian
    Replies: 4
    Last Post: 2008-07-11, 03:00
  2. [moved] java.lang.IllegalArgumentException:Port format
    By cisa in forum Mobile Java Tools & SDKs
    Replies: 10
    Last Post: 2008-06-23, 16:36
  3. Question about returned code...
    By Dansco in forum Symbian
    Replies: 4
    Last Post: 2008-06-10, 16:20
  4. Code Optmization Question
    By Spider_Eg in forum Mobile Java General
    Replies: 2
    Last Post: 2006-04-05, 12:35
  5. Testing HTTP client for Nokia 3650; Looking to share code
    By nawkboy in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2003-09-10, 15:30

Posting Permissions

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