Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Clean up registered listeners #1865

Open
programmerr47 opened this issue Oct 4, 2016 · 3 comments
Open

Clean up registered listeners #1865

programmerr47 opened this issue Oct 4, 2016 · 3 comments

Comments

@programmerr47
Copy link

Hi. Currently as I understand everything correctly we cleaning up views in onDestroyView method. Here was as I remember one of the latest discussion about this topic.

I agree with proposals, but could we enhance it a little bit? Currently we can hang listeners to views through bunch of annotations (for example @OnFocusChange). The question is: can we release those listeners (which we added by annotations) before cleaning up views?

@WonderCsabo
Copy link
Member

We should definitely do this. However when we should cleanup in case of @EView(Group) and @EActivity. @dodgex wdyt?

@dodgex
Copy link
Member

dodgex commented Nov 23, 2016

Sounds like a good idea. But it looks like it might become a bit complicated

from what i found from a short time of googling:

  • some listeners (e.g.) focus can be removed by calling setOnFocusChangeListener with null
    -but others (e.g.) text change listener work on a add/remove mechanic so we have to store the handler here

@WonderCsabo
Copy link
Member

We have to add a new method to ListenerHandler, generateRemoveListener() or sg like this, and implement it in each listener. And yeah, we have to store the listeners in a field. :(

It is a bigger task.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants