register receiver with app context rather than a single activity's so

that it doesn't leak when that activity goes away.
This commit is contained in:
Andy2 2011-02-14 18:12:46 -08:00
parent 0354c3f1d9
commit 526b3c1bef

View file

@ -80,8 +80,8 @@ public class NetStateCache {
IntentFilter filter = new IntentFilter();
filter.addAction( ConnectivityManager.CONNECTIVITY_ACTION );
Intent intent = context.registerReceiver( s_receiver,
filter );
Intent intent = context.getApplicationContext().
registerReceiver( s_receiver, filter );
s_ifs = new HashSet<StateChangedIf>();
s_haveReceiver = true;