public < T > Observable < T > getAndObserve ( String key , Class < T > classOfT , T defaultValue ) { return getAndObserve ( key , TypeToken . fromClass ( classOfT ) , defaultValue ) ; }
Gets value from SharedPreferences with a given key and type as a RxJava Observable which can be subscribed . If value is not found we can return defaultValue . Emit preference as first element of the stream even if preferences wasn t changed .