6

关于 viewModel 使用的一些疑问

 1 year ago
source link: https://www.v2ex.com/t/866736
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Android

关于 viewModel 使用的一些疑问

  jeesk · 5 小时 28 分钟前 · 449 次点击

现在我正在开发一款相册, 因为底部有 3 个导航按钮, 所以 activity 里面其实是 3 个 fragment 在切换展示视图, 这个时候我看到有些例子可以使用 viewModel 来管理界面视图, 这个时候因为我的相册是在 fragment 里面, 那 viewModel 我是该使用 mainActivity 的 viewModel, 还是 fragment 里面的 viewModel 呢? android 小白一个, 请赐教。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK