# HG changeset patch # User Da Risk # Date 1261054495 -3600 # Node ID 739518ae68e08782348b5a0d51cf7cdb120b487d # Parent 0536a2190b29e1dab363476ef0008f0a7fcec064 Fixes #228 You must renmove the callback listeners attached with the service when you destroy the activities. diff -r 0536a2190b29 -r 739518ae68e0 src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Wed Dec 16 20:48:57 2009 +0100 +++ b/src/com/beem/project/beem/ui/ContactList.java Thu Dec 17 13:54:55 2009 +0100 @@ -66,6 +66,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.preference.PreferenceManager; +import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.Menu; @@ -122,6 +123,8 @@ private BeemBroadcastReceiver mReceiver; private final Map mIconsMap = new HashMap(); private LayoutInflater mInflater; + private ComparatorContactListByStatusAndName mComparator = new ComparatorContactListByStatusAndName(); + private final BeemRosterListener mBeemRosterListener = new BeemRosterListener(); /** * Constructor. @@ -292,8 +295,20 @@ @Override protected void onDestroy() { super.onDestroy(); + try { + if (mRoster != null) + mRoster.removeRosterListener(mBeemRosterListener); + } catch (RemoteException e) { + Log.d("ContactList", "Remode exception", e); + } this.unregisterReceiver(mReceiver); - unbindService(mServConn); + unbindService(mServConn); + mRoster = null; + /* + for (BitmapDrawable d : mIconsMap.values()) { + d.setCallback(null); + }*/ + Log.e("CONTACTLIST", "onDestroy activity"); } /** @@ -305,7 +320,6 @@ * Constructor. */ public ComparatorContactListByName() { - } /** @@ -325,7 +339,6 @@ * Constructor. */ public ComparatorContactListByStatusAndName() { - } /** @@ -373,7 +386,6 @@ * Constructor. */ public BeemContactListOnClick() { - } /** @@ -426,7 +438,7 @@ * Sort the contact list. */ private void sortBeemContactList() { - Collections.sort(mListContact, new ComparatorContactListByStatusAndName()); + Collections.sort(mListContact, mComparator); } /** @@ -437,7 +449,6 @@ * Constructor. */ public BeemRosterListener() { - } /** @@ -749,7 +760,6 @@ * The service connection used to connect to the Beem service. */ private class BeemServiceConnection implements ServiceConnection { - private final BeemRosterListener mBeemRosterListener = new BeemRosterListener(); /** * Constructor.