Hi all ,

 i having issues regarding location listener in myService class
file ..

here is code i like to share ..

myService.java

///onStart method ..
onStart() {
 locationManager = (LocationManager) getSystemService
(Context.LOCATION_SERVICE)
.
.
 provider = locationManager.getBestProvider(criteria, true);
locationListener = (LocationListener) new MyLocationListener();
locationManager.requestLocationUpdates(provider, 0, 0,
locationListener);
}

////
///In myActivity.java.. having btn to stop the service
OnClick of stop btn in myActivity . ..am doing
stopService(new Intent(getApplicationContext(), myService.class)

myService.java
////onDestroy method....
onDestroy() {

locationManager=(LocationManager) getSystemService
(Context.LOCATION_SERVICE);
locationManager.removeUpdates(locationListener); //Getting **exception
here ....

}

 **exception:::
java.lang.IllegalArgumentException: listener==null at
android.location.LocationManager.removeUpdates(LocationManager.java:
799) at
<.package_name>myService.onDestroy(myService.java:407)

I dont know Y listener turns null without reason .. kindly guide
further on it .. .where am i going wrong !!!

thank u ..

regards
Sheik

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to