2

I have been working as an Android Developer since last 4 years. And recently I started to learn MVP with Clean architecture. I am not using any library like Dagger, Retrofit or anything because I want to understand the architecture.

I created a project with MVP clean way. However, I am not able to figure out that where can I add network operations (background thread) and how?

I added one UseCase and it is working fine if I use static data without using any background thread. But cannot understand where to add background thread?

Is anyone can help me with that? let me know if you need more information.

Thanks.

yogi
  • 309
  • 1
  • 3
  • 13

1 Answers1

0

Best approuch, presentation layer works on mainThread (UI), but Domain and Data Layers works on worker thread. After domain layer return new model, you call some method inside view and user sees updates.

If you are using RxJava, inside presenter you could control your threads. Also with this approuch you could combine multiply request to domain layer and etc. Use RxJava, it is really cool.

Also in github there are a lot of implementations, grab it, learn it. A few days, and you will become a clean arch master :)

Here i described how clean architecture works by layer. Example1, example2

Dmytro Ivanov
  • 1,260
  • 1
  • 8
  • 10