The communication between View
& Presenter
should be through an interface
.
Both Presenter
and Activity
(view) have their own interface
.
- So a List item click item is forward to a Presenter.
- The Presenter decides what to do. i.e. open a DetailsActicity
- Call's the Activity to start new Intent.
Here's a good example of MVP interfaces
A good/brief explanation of MVP
Edit
- Communication between
Adapter
& Activity
/Fragment
.
First point - in my personal view Adapter
& Activity
/Fragment
are all subsections of View
in the MVP architecture.
The Activity
will hold reference to the Adapter
The Activity
(via the Presenter
) can mainpualte the data in the adapter by the usual means i.e. changing the underlying data object and calling notifyDataSetChanged
.
As for the Adapter
sending requests back to the Activity
i.e. View.OnClickListener
this can be done via callbacks that are sent when the Adapter
is first initialised (i.e. created using the new
keyword)