Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which would be the best way to do an async database call when using DroidMVP? #10

Closed
cristian-calugar opened this issue Jul 11, 2016 · 2 comments

Comments

@cristian-calugar
Copy link

Hi Andrzej,

We would like to use DroidMVP library in our project. From the MVP examples that we have researched, this one seems to be the most clear, easy to understand and adapt to our project.

What we would like to know is what do you believe that would be the best way to implement an async database call from a presenter. Would you be kind to add such an example in the sample app?

Thanks in advance,
Cristi.

@andrzejchm
Copy link
Owner

It's a bit out of scope of this library, but my solution would be to create *Usecase (or if you preffer: *Interactor class that would encapsulate specific usecase of the business logic (for example retrieving User details) and which would then be executed from within presenter either by a some sort of UsecaseExecutor which deals with delegating work to background thread and reporting back the results to main thread or to simply use RxJava with correct schedulers.

a small example: https://gist.github.com/andrzejchm/b78bb7412d31078e4d8e9841401914a9

@cristian-calugar
Copy link
Author

Thank you Andrzej!
Just wanted to know your opinion. We were also looking at similar solutions with and Interactor or Rx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants