Not getting Lat/Long on Emulator as well as on device
<p>i am done code for getting current lat/long as follow but i always get null from lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); method.</p>

<p>i have tried by 2 ways.</p>

<p>the code is below.</p>

<p>first way,</p>

<pre><code>LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

if(location != null)
{
    lat = location.getLatitude();
    lon = location.getLongitude();
}
</code></pre>

<p>and second way,</p>

<pre><code>LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

Log.d("GPS_PROVIDER","GPS_PROVIDER = " + lm.isProviderEnabled(LocationManager.GPS_PROVIDER));
Log.d("NW_PROVIDER","NW_PROVIDER = " + lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER));

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListenerAdapter()
{
   @Override
   public void onLocationChanged(Location location) 
  {
          if(location != null)
      {
        lat = location.getLatitude();
        lon = location.getLongitude();
      }
  }
});
</code></pre>

<p>LocationListenerAdapter class is implements the method of LocationListener interface and i keep all method blank
i.e no code written into that methods.</p>

<p>i also use gpx and kml file for emulator to change lat/long but i didn't get yet.
can any one provide best answer.</p>

<p>Thanks in advance.</p>
