4

I have an object A which contains a lot of data. It has a counter, a title, a color and a list of other objects. That content is supposed to be displayed in a fragment F.

I want to be able to initiate multiple instances of F at the same time (my app is designed for tablets, so I have more space then on phones).

A is intended to be draggable by the user.

What's the best way for me to structure my code? Should each fragment have it's own ViewModel?

MSpeed
  • 8,153
  • 7
  • 49
  • 61
Christian
  • 25,249
  • 40
  • 134
  • 225
  • I think It will go like this https://stackoverflow.com/questions/9398057/android-move-a-view-on-touch-move-action-move it will make it draggable. Basically, it is working on touch listeners like actions. – raj kavadia May 14 '19 at 11:13
  • It sounds more like a use-case for a `RecyclerView`. So basically: One fragment. One view model. Several items which are not fragments. – tynn May 16 '19 at 14:12
  • Since the data is the same, having one view model would suffice. – Dinesh May 21 '19 at 10:08

0 Answers0