Thanks Ricky, I have to say tho that this content is a bit outdated. Here I talk a bit about Clean Architecture + MVVM : th-cam.com/video/K1aC7eO6vbw/w-d-xo.html&t let me know what you think! :)
Hey! Great post! Trying to implement MVP with this architecture, but what Im stuck with is: How can the VotingActivity know the concrete implementation of their mPresenter that it holds? I can only show the methods of the abstract class, and not the VotingPresenter class. For instance when my concrete Activity implementation grabs my mPresenter.method() the abstract methods of BasePresenter are only visible.
Hey GidZk! Thx for the comment. Somehow you need some public methods in your presenter so you can pass data from the View to the Presenter, but you are correct, the VIEW indeed will have to understand what method to call given one user interaction. Another way to do it, using the reactive concept, is to make your presenter Observe changes in the View, so the VIEW will be even more passive, but that would increase the complexity of the code. Did I answer your question?
Mina Samir you should call a method from the BO that will access the DAO(or repository as they call it) object, it may have Android dependencies. It was done in the task "FetchProfileTask". In this way, when testing you can mock your DAO
You are actually right. There should be an improvement in the naming conventions so the Presenter will only know things like : "render the UI" or "screen is not visible" and so on...
Great series on MVP! Thanks , amazing explanation and code
Thanks Ricky, I have to say tho that this content is a bit outdated. Here I talk a bit about Clean Architecture + MVVM : th-cam.com/video/K1aC7eO6vbw/w-d-xo.html&t let me know what you think! :)
You need to show a UML diagram and the app packages so we can have a high level understanding of the relationships.
That'd be great!
Thanks for the suggestion!
Excellent tutorial on MVP architecture. Thank you.
Pushpal Roy I am glad you liked it.
Hey! Great post! Trying to implement MVP with this architecture, but what Im stuck with is:
How can the VotingActivity know the concrete implementation of their mPresenter that it holds? I can only show the methods of the abstract class, and not the VotingPresenter class.
For instance when my concrete Activity implementation grabs my mPresenter.method() the abstract methods of BasePresenter are only visible.
Hey GidZk! Thx for the comment. Somehow you need some public methods in your presenter so you can pass data from the View to the Presenter, but you are correct, the VIEW indeed will have to understand what method to call given one user interaction. Another way to do it, using the reactive concept, is to make your presenter Observe changes in the View, so the VIEW will be even more passive, but that would increase the complexity of the code. Did I answer your question?
Hi Renaro, it wouldnt be the same if you would not use generics and you would put BasePresenter as a field of BaseActivity?
Yes, but I would still need a 'BasePresenter' since I want to force all BaseActivities to have a presenter
Please Upload Model Part..Thanks To you I have Got a little Understanding to MVP...!!
Hey Mohammad. Very glad you liked it. I will try to do it as soon as possible. Regards.
If I should never use any android API in presenter .. how to read from sqlite database ..
Mina Samir you should call a method from the BO that will access the DAO(or repository as they call it) object, it may have Android dependencies. It was done in the task "FetchProfileTask". In this way, when testing you can mock your DAO
How should I pass context from activity to the DAO .. or it will be handled by another way.
Mina Samir the way I have done in this video I created all dependencies within the activity.
Thankyo.👍
Thank you!
Why make your presenter lifecycle aware(onResume, onPause etc)? Shouldn't it know nothing about the android apis?
You are actually right. There should be an improvement in the naming conventions so the Presenter will only know things like : "render the UI" or "screen is not visible" and so on...
dude its boring u should write code rather speak blah blah blah
khawajah Arsalan Thanks for the feedback, I wouldn't been able to code and cover all the topics. Next video I will code a bit at least.
:) thankx
There is an awesome quote by John Johnson - "First, solve the problem. Then, write the code."