Receiver not registered: android.widget.ViewFlipper 问题

项目排查LOG,发现有:

java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper$1@4056ef50
	at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:610)
	at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:825)
这样的问题,经过资料查询,有说法是需在 onDetachedFromWindow中添加捕捉,项目现在这样干的,留此备忘!

下面提供一个很简单的解决方案,重写 ViewFlipper 的 onDetachedFromWindow() 方法


@Override
protected void onDetachedFromWindow () {
try {
super.onDetachedFromWindow();
}
catch (IllegalArgumentException e) {
stopFlipping();
}
}

你可能感兴趣的:(Receiver not registered: android.widget.ViewFlipper 问题)