问题描述
我加入一个 ViewFlipper
从布局资源成的ListView充气
为页脚
。这里是我的鳍状肢的布局(不再赘述细节):
I'm adding a ViewFlipper
inflated from a layout resource into a ListView
as a Footer
. Here's my flipper layout (Details omitted for brevity):
<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper ...>
<Button
/>
<LinearLayout
... >
<ProgressBar
... />
<TextView
... />
</LinearLayout>
</ViewFlipper>
我用它添加到我的ListView:
I add it to my ListView using :
mListView.addFooterView(mLoadMoreFlipper);
在我的活动被破坏我看到下面的消息,随后调用堆栈,在LogCat中:
When my activity is destroyed I see the following message, followed by a call stack, in LogCat:
Activity com.gk.ItemListActivity has leaked IntentReceiver android.widget.ViewFlipper$1@44c84ab0
that was originally registered here. Are you missing a call to unregisterReceiver()?
我做了一些挖了一圈,发现出来的消息与未注销接收器,但我还没有注册的任何。奇怪的是只有在页脚 ViewFlipper
已移出此消息出现在的ListView
毁灭之前(通过使用后退键) 。我取下页脚时,我不再需要它使用:
I did some digging around and found out the message is related to not unregistering receivers, except I haven't registered any. Oddly this message only appears if the footer ViewFlipper
has been removed from the ListView
before destruction (by using the back button). I detach the footer when I no longer need it by using:
mListView.removeFooterView(mLoadMoreFlipper);
我已经使用的WeakReference
到 ViewFlipper
试过,但没有帮助。我也尝试设置 mLoadMoreFlipper
参照空
但这并没有帮助。
I have tried using a WeakReference
to the ViewFlipper
but that doesn't help. I also tried setting the mLoadMoreFlipper
reference to null
but that doesn't help either.
有没有人遇到过这个问题吗?这似乎与我的活动抱着一个参考 ViewFlipper
之后,它已经从的ListView分离
,但我做的不知道如何明确地摧毁 ViewFlipper
。
Has anyone encountered this problem before? This seems to be related to my activity holding a reference to the ViewFlipper
after it's been detached from the ListView
but I do not know how to explicitly destroy the ViewFlipper
.
推荐答案
请参阅。显然有在ViewFlipper的错误。在包含了解决办法。
See View Flipper Throws Exception in ViewFlipper.onDetachedFromWindow. Apparently there is a bug in ViewFlipper. The contains the workaround.
这篇关于活动已经泄露IntentReceiver android.widget.ViewFlipper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!