I add a ViewFlipper inflated from the layout resource to the ListView as a Footer . Here's my flipper layout (details are 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 the 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 ruined a bit and found out that the message is due to the fact that you are not registering receivers, except that I did not register them. Oddly enough, this message only appears if the ViewFlipper footer ViewFlipper been removed from the ListView before being destroyed (using the back button). I disconnect the footer when I no longer need it using:
mListView.removeFooterView(mLoadMoreFlipper);
I tried using WeakReference for ViewFlipper , but that does not help. I also tried setting the mLoadMoreFlipper link to null , but that doesn't help either.
Has anyone encountered this problem before? This is similar to my activity, referring to the ViewFlipper after it has been separated from the ListView , but I don't know how to explicitly destroy the ViewFlipper .
source share