public void onDestroy() { if (mFolderObserver != null) { mFolderObserver.unregisterAndDestroy(); mFolderObserver = null; } mAccountObserver.unregisterAndDestroy(); mHandler.removeMessages(SubtitleHandler.EMAIL); }
public void initialize( ControllableActivity activity, ActivityController callback, ActionBar actionBar) { mActionBar = actionBar; mController = callback; mActivity = activity; initializeTitleViews(); mFolderObserver = new FolderObserver() { @Override public void onChanged(Folder newFolder) { onFolderUpdated(newFolder); } }; // Return values are purposely discarded. Initialization happens quite early, and we don't // have a valid folder, or a valid list of accounts. mFolderObserver.initialize(mController); updateAccount(mAccountObserver.initialize(activity.getAccountController())); }