ViewFlipper导致应用程序在Back Pressed上崩溃 [英] ViewFlipper causing application to crash on Back Pressed

查看:71
本文介绍了ViewFlipper导致应用程序在Back Pressed上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的片段中有两个视图鳍状肢,一个翻转3个视图,另一个翻转2.我翻转所有视图然后继续下一个片段。如果在下一个片段上我点击后退按钮,应用程序在logcat中崩溃:

I have a two view flippers in my fragment, in one I flip 3 views and in the other 2. I flip all views and then proceed to the next fragment. If on this next fragment I hit the back button, the app crashes with this in the logcat:

Activity has leaked IntentReceiver android.widget.ViewFlipper$1@41e58cc0 that was originally registered here. Are you missing a call to unregisterReceiver()?



我已经对此进行了大量研究,常见的解决方案是实现自定义视图翻转器,我已经完成了:


I have researched this a lot and the common solution is to implement a custom view flipper, which I have done:

public class CustomViewFlipper extends ViewFlipper {
    public CustomViewFlipper(Context context) {
        super(context);
    }
    public CustomViewFlipper(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    @Override
    protected void onDetachedFromWindow() {
        try {
            super.onDetachedFromWindow();
        }
        catch (IllegalArgumentException e) {
            stopFlipping();
        }
    }
}





但是这不能解决问题。有没有人能够解决这个问题?我知道视图翻录器中有一个错误,如果有人可以帮忙解决这个问题,我会很感激



However this doesn't resolve the issue. Has anyone been able to resolve this? I know that there is a bug in view flipper, if anyone could help with this I'd appreciate it

推荐答案

1 @ 41e58cc0最初在这里注册。你是否错过了对unregisterReceiver()的调用?
1@41e58cc0 that was originally registered here. Are you missing a call to unregisterReceiver()?



我已经对此进行了大量研究,常见的解决方案是实现自定义视图翻转器,我已经完成了:


I have researched this a lot and the common solution is to implement a custom view flipper, which I have done:

public class CustomViewFlipper extends ViewFlipper {
    public CustomViewFlipper(Context context) {
        super(context);
    }
    public CustomViewFlipper(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    @Override
    protected void onDetachedFromWindow() {
        try {
            super.onDetachedFromWindow();
        }
        catch (IllegalArgumentException e) {
            stopFlipping();
        }
    }
}





但是这不能解决问题。有没有人能够解决这个问题?我知道视图鳍状肢有一个错误,如果有人可以帮助我,我会很感激



However this doesn't resolve the issue. Has anyone been able to resolve this? I know that there is a bug in view flipper, if anyone could help with this I'd appreciate it


这篇关于ViewFlipper导致应用程序在Back Pressed上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆