Receiver not registered exception error?

后端 未结 10 2246
醉酒成梦
醉酒成梦 2020-11-28 05:41

In my developer console people keep reporting an error that I cannot reproduce on any phone I have. One person left a message saying he gets it when they try to open the set

10条回答
  •  抹茶落季
    2020-11-28 06:13

    I used a try - catch block to solve the issue temporarily.

    // Unregister Observer - Stop monitoring the underlying data source.
            if (mDataSetChangeObserver != null) {
                // Sometimes the Fragment onDestroy() unregisters the observer before calling below code
                // See http://stackoverflow.com/questions/6165070/receiver-not-registered-exception-error
                try  {
                    getContext().unregisterReceiver(mDataSetChangeObserver);
                    mDataSetChangeObserver = null;
                }
                catch (IllegalArgumentException e) {
                    // Check wether we are in debug mode
                    if (BuildConfig.IS_DEBUG_MODE) {
                        e.printStackTrace();
                    }
                }
            }
    

提交回复
热议问题