title: How i can get Latitude and Longitude in blackberry?
body: <p>i am developing app in Blackberry which have GPS Functionality. so first i want to get Current latitude and longitude but it will dipslay like <strong>time out while waiting for GPS loaction.</strong> Below in my code for getting lat and long of current location.</p>
  
  <pre><code>public class LocationScreen extends MainScreen 
  {
        public LocationScreen() 
        {
          super();
          final LabelField lfLocation = new LabelField();
          new Thread()
          {
            public void run() 
            {
              LocationHandler lh = new LocationHandler();
              final String msg = "Long: " + lh.getCurrentLongitude() + ", Lat: " + lh.getCurrentLatitude();
  
              Application.getApplication().invokeLater(new Runnable() 
              {
                public void run() 
                {
                  lfLocation.setText(msg);
                  add(new LabelField("Lat and Long=="+msg));
                }
              });
            }
          }.start();
          this.add(lfLocation);
        }
      }
  
  **Second Class**
  
  public class LocationHandler 
  {
    private LocationProvider locationProvider;
    private Location currentLocation;
    public LocationHandler()  
    {
      try 
      {
        locationProvider = LocationProvider.getInstance(null);
        currentLocation = locationProvider.getLocation(60);
      }
      catch (final Exception e) 
      {
        Application.getApplication().invokeLater(new Runnable() 
        {
          public void run() 
          {
            Status.show(e.getMessage());
          }
        });
      }
    }
    public double getCurrentLongitude() 
    {
      if(currentLocation != null)
        return currentLocation.getQualifiedCoordinates().getLongitude();
      return -1;
    }
    public double getCurrentLatitude() 
    {
      if(currentLocation != null)
        return currentLocation.getQualifiedCoordinates().getLatitude();
      return -1;
    }
  </code></pre>
  
  <p>what i am doing mistake in my code please help me.
  Thanx in advance.</p>