我是靠谱客的博主 秀丽玫瑰,最近开发中收集的这篇文章主要介绍Caused by: java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
问题描述
在使用ViewFlipper时,爆出一下Bug.
Caused by: java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper$1@424fe0d8
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:658)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1601)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:489)
at android.widget.ViewFlipper.onDetachedFromWindow(ViewFlipper.java:106)
at android.view.View.dispatchDetachedFromWindow(View.java:12857)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2732)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2730)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2730)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2730)
at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4287)
at android.view.ViewGroup.removeAllViews(ViewGroup.java:4219)
at com.gjcx.zsgj.module.other.fragment.TextAdFragment.onPause(TextAdFragment.java:67)
解决方案:
http://daniel-codes.blogspot.com/2010/05/viewflipper-receiver-not-registered.html
http://stackoverflow.com/questions/8050730/viewflipper-receiver-not-registered
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ViewFlipper;
public class GabrielleViewFlipper extends ViewFlipper {
public GabrielleViewFlipper(Context context) {
super(context);
}
public GabrielleViewFlipper(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDetachedFromWindow() {
try {
super.onDetachedFromWindow();
}
catch (IllegalArgumentException e) {
stopFlipping();
}
}
}
and in your layout dont use the normal ViewFlipper, use GabrielleViewFlipper:
最后
以上就是秀丽玫瑰为你收集整理的Caused by: java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper的全部内容,希望文章能够帮你解决Caused by: java.lang.IllegalArgumentException: Receiver not registered: android.widget.ViewFlipper所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复