DanielSerdyukov / droidcon2016

Apache License 2.0
7 stars 0 forks source link

ViewModel extended from Fragment? #1

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi, can you explain in two words why you extend ViewModels from Fragment? I analyze many examples with google data binding but is for first time where i see that approach ))

Thanks!

DanielSerdyukov commented 8 years ago

Hi! Extends from fragment to save VM as "retain instance" between configuration changes and get access to lifecycle without any proxy methods

ghost commented 8 years ago

Got it! Also:

  1. Would you use this approach in production? At least data binding?
  2. Another way to implement some think like MVVM is with RxJava, wanted to know (if you try it) kind of these ways (rx vs data binding) you find the best option ))

Thanks!