Removing TelephonyManager listener - Help please.

Showing 1-2 of 2 messages
Removing TelephonyManager listener - Help please. Ne0 7/23/09 1:43 AM
Hi,

I have written a small activity to listen to and make a sound when the
LAC changes, i did this with:

mTelephonyManager.listen
(mMGPhoneListener,PhoneStateListener.LISTEN_CELL_LOCATION);

All works fine, until i hit my stop button, which calls finish(). My
understanding is that the activity should be destroyed from this call.
The activity appears to close, though my listener still alarms when
there is a LAC change. It seems to carry on running indefinitely, i
have tried a few things to no avail.

I have tried to remove the listener by adding a fake one that does
nothing but overwrite the old one, before i call finish though this
does not work either.

Am i misunderstanding the Activity life cycle?

Liam
Re: [android-beginners] Removing TelephonyManager listener - Help please. Fernando Manso 7/23/09 4:33 AM

Try:

mTelephonyManager.listen(mMGPhoneListener,PhoneStateListener.LISTEN_NONE);