You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the constructor of RXSharedPreferences a preference listener created and registered using registerOnSharedPreferenceChangeListener(). The documentation of this method states:
The preference manager does not currently store a strong reference to the listener. You must store a strong reference to the listener, or it will be susceptible to garbage collection. We recommend you keep a reference to the listener in the instance data of an object that will exist as long as you need the listener.
That's why it is very important for developers to keep a reference to the RxSharedPreferences instance as long as one needs to listen to changes. I just stumbled upon this issue myself - kept me busy for around an hour before I found the culprit. Thought I was using the library wrong. We should update the README so it states clearly that it is necessary to keep a RxSharedPreferences reference. I'll propose an according change later today.
The text was updated successfully, but these errors were encountered:
ubuntudroid
added a commit
to ubuntudroid/rx-preferences
that referenced
this issue
Feb 8, 2017
In the constructor of RXSharedPreferences a preference listener created and registered using
registerOnSharedPreferenceChangeListener()
. The documentation of this method states:That's why it is very important for developers to keep a reference to the
RxSharedPreferences
instance as long as one needs to listen to changes. I just stumbled upon this issue myself - kept me busy for around an hour before I found the culprit. Thought I was using the library wrong. We should update the README so it states clearly that it is necessary to keep aRxSharedPreferences
reference. I'll propose an according change later today.The text was updated successfully, but these errors were encountered: