this exception cause due to because your device cant get last location
thats why you got null pointer exception

Location mLocation = mLocationManager.
getLastKnownLocation(locationprovider);
        if (mLocation!= null)
        String text = "Last location lat: " + mLocation.getLatitude()
        + "long: " + mLocation.getLongitude();
        //+ "speed :" + mLocation.getSpeed() +
        //   "Time: " + mLocation.getTime();

        tv.setText(text);
else{
Toast.maketext(MyLocation.this,"Last Location not
found",Toast.LENGTH_LONG).show();
}

-- 
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

Reply via email to