Hadi
Hadi

Reputation: 574

Where should i put downloader classes in MVVM?

I've written a download manager app for Android. Now i want to refactor it's structure to MVVM. but i have some questions.

  1. Into what layer I should movedownloader classes such as DownloadManager.java (which manages download queue, etc), Downloader.java (which creates an empty file then downloads data and write into that empty file), etc?

  2. into what layer i should move Application class which is responsible for creating database for the first time?

thanks.

Upvotes: 2

Views: 890

Answers (1)

Ashraf Patel
Ashraf Patel

Reputation: 749

Let's say you have 3 layers,

  • View(Activities, Fragments, CustomView, ..)
  • BusinessLogic(Presenter, Viewmodel, ..)
  • Data(Repository, ..)

Downloader.java should be in the Data layer

Upvotes: 2

Related Questions