rx java - Prefetching network data with RxJava/Android -


i creating android events app uses rxjava wrap old network layer , cache setup observable.create(). i'm stumped how approach prefetching data though. display list of events open eventdetail activity fetch contents of given event. want prefetch of events' contents, end making redundant network calls if event selected before prefetch returns , caches. there way keep observables/subscriptions alive on activity switches? singleton network layer held in application? appreciated.

typically, keep logic away activities, so, "yes, definitely!": network layer need.

keeping approach, subscriptions stay alive if activity restarted, instance, on rotation. useful operator need .cache(), reuse ongoing network request instead of firing new 1 on new subscribe().


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -