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>
I add it to my ListView using :
mListView.addFooterView(mLoadMoreFlipper);
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()?
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);
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.
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
.
See View Flipper Throws Exception in ViewFlipper.onDetachedFromWindow. Apparently there is a bug in ViewFlipper. The contains the workaround.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With