Android-ViewModelBinding icon indicating copy to clipboard operation
Android-ViewModelBinding copied to clipboard

Usage with Fragment? Enhancement tips.

Open zayo opened this issue 9 years ago • 0 comments

I like to use these VM, but there is some use cases where it is hard to use IT.

For example: Activity -> Fragment -> VM -> ViewPager

If i want to have Fragments in ViewPager i have to use childFragmentManager(), it is accessible from Fragment, but not from VM. Also if i have VM i could get parent activity, but not parent Fragment. When i got tablet application, i would use fragments. Of course i want to use arguments for fragments. But i cannot obtain them from VM directly, especialy in onViewAttached, where I should. How to deal with this problems? Will it be fixed?

Another Enhancement question: Why is BaseActivity extends AppCompatActivity, but BaseViewModel getActivity() returns Activity?

I am not fully familiar with pull request, so that is the reason why i write here, instead of code. Thanks

zayo avatar Aug 04 '16 20:08 zayo