Hii , i want to get the current position on the map on basis of latitude
and longitude. But the program crashes with a null pointer exception
05-05 18:05:34.444: E/AndroidRuntime(858): java.lang.NullPointerException
05-05 18:05:34.444: E/AndroidRuntime(858): at
hello.WSTest.MapWs.onLocationChanged(MapWs.java:217)
05-05 18:05:34.444: E/AndroidRuntime(858): at
android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:227)
05-05 18:05:34.444: E/AndroidRuntime(858): at
android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:160)
05-05 18:05:34.444: E/AndroidRuntime(858): at
android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:176)
i have used the code below
public void onLocationChanged(Location location) {
lat = location.getLatitude();
lng = location.getLongitude();
Toast.makeText(
getBaseContext(),
"Location change to : Latitude = " + lat + " Longitude = "
+ lng, Toast.LENGTH_SHORT).show();
GeoPoint p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
mc.animateTo(p);
mc.setCenter(p);
}
please can someone help me to solve that issue , thanks in advance
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.