Model-View-Presenter: Android guidelines
Francesco Cervone
5.2K48

Its very good article on MVP especially for android developer. Thank you.

I have query related to asyncTask. Let me put with example to be clear.

Requirement is to get filePath from UI/Activity(VIEW) then copy the file using asyncTask , once copy is done update the MODEL with copied filePath later update the UI/Activity(VIEW) with status.

To fit in MVP,

I have moved Activity and AsyncTask in VIEW layer. And PRESENTER will device which asyncTask to run(assume there can be more than one async task depend on file path).

Following are my doubts,

  1. As it is asyncTask and don't have any UI, can we move asyncTask to VIEW layer ?. Can we consider it as View ?. If its view then does it need its own presenter to interact with MODEL(to keep 1 to 1 view presenter mvp design)?.
  2. If we consider it as VIEW, once doinBacground is done, Do we need to use same presenter object used by Activity to update MODEL ?.

I know that we can make our own changes to fit in MVP. But i want to follow my code to fit in all basic rules for MVP .

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.