Fix bug #14399525 settings crash on opening login error notification
- check if the account istener has been previously added or not Change-Id: Icfd111a406507ac520a396e44710a9d882f2ae4d
This commit is contained in:
@@ -46,6 +46,7 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
|
|||||||
private ViewGroup mContainer;
|
private ViewGroup mContainer;
|
||||||
private ViewGroup mDashboard;
|
private ViewGroup mDashboard;
|
||||||
private AuthenticatorHelper mAuthHelper;
|
private AuthenticatorHelper mAuthHelper;
|
||||||
|
private boolean mAccountListenerAdded;
|
||||||
|
|
||||||
private static final int MSG_BUILD_CATEGORIES = 1;
|
private static final int MSG_BUILD_CATEGORIES = 1;
|
||||||
private Handler mHandler = new Handler() {
|
private Handler mHandler = new Handler() {
|
||||||
@@ -123,14 +124,20 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
AccountManager.get(getActivity()).addOnAccountsUpdatedListener(this, null, false);
|
if (!mAccountListenerAdded) {
|
||||||
|
AccountManager.get(getActivity()).addOnAccountsUpdatedListener(this, null, false);
|
||||||
|
mAccountListenerAdded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
|
|
||||||
AccountManager.get(getActivity()).removeOnAccountsUpdatedListener(this);
|
if (mAccountListenerAdded) {
|
||||||
|
AccountManager.get(getActivity()).removeOnAccountsUpdatedListener(this);
|
||||||
|
mAccountListenerAdded = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTileView(Context context, Resources res, DashboardTile tile,
|
private void updateTileView(Context context, Resources res, DashboardTile tile,
|
||||||
|
Reference in New Issue
Block a user