Questions tagged [android-mvp]

On Android, MVP is a way to separate background tasks from activities/views/fragments to make them independent of most lifecycle-related events. This way an application becomes simpler and code maintainability becomes better. Use this tag if your question is specifically about using MVP in Android.

On Android, MVP is a way to separate background tasks from activities/views/fragments to make them independent of most lifecycle-related events. This way an application becomes simpler and code maintainability becomes better. Use this tag if your question is specifically about using MVP in Android.

The tag should be used along with

278 questions
40
votes
8 answers

Is Content Provider an implementation of Repository Pattern?

Repository Pattern is defined by Hieatt and Rob Mee as design pattern that mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects. Basically it abstracts one or more I/O devices (cloud,…
JP Ventura
  • 5,564
  • 6
  • 52
  • 69
13
votes
2 answers

How to inject Mocked Presenter of Activity in Instrumentation testing with Espresso

I have been trying this for a week. And I have crawled every article available but their implementations or examples fall short or stop at the steps of Espresso Tests. My Android Application follows MVP architecture (And is in Java) Scenario:…
yUdoDis
  • 1,098
  • 6
  • 15
13
votes
1 answer

Clean architecture. What are the jobs of presenter?

I have been reading some articles about the clean architecture, and how it can be implemented in android. I saw the sample app which shows its Android Implementation. Also, I went through a nice talk on Clean architecture on Android So, I kind of…
user4260260
12
votes
2 answers

Can I register MVP Presenter inside Fragment

I've been following MVP design pattern provided by Google to refactor my application. I have one MainActivity and many Fragments and it seems little be messy for me to create an activity for every fragment, so I've been thinking to register…
MilanNz
  • 1,323
  • 3
  • 12
  • 29
11
votes
4 answers

Recovering presenters for the ViewPager fragments (MVP)

I'm trying to refactor an existing application to use the MVP architecture. One of the activities has a ViewPager with three fragments. Each fragment is linked with a presenter. To be precise - each presenter, when created, is given a View to work…
vkislicins
  • 3,331
  • 3
  • 32
  • 62
10
votes
1 answer

Live Data in MVP architectural pattern

I have an application with MVP architectural pattern. Now, I am trying to implement Livedata in my application. I searched a lot , but I can not found any tutorial or example for this. All tutorial says live data is for MVVM pattern. Applying…
Ranjith KP
  • 858
  • 6
  • 18
10
votes
1 answer

what is the difference between presenter in mvp and view-model in mvvm

I need to clear some of my doubts regarding mvp and mvvm design pattern 1) In mvp and mvvm who updates the view .The presenter/view-model set the data to be displayed in the view or the view retrieve the data from presenter/view-model and …
user6250541
10
votes
3 answers

What role an Android Service should play in the MVP pattern?

I am developing an Android app that does Human Activity Recognition. It basically works like that - Service constantly reads the accelerator data and stores the recognized activity (i.e. Walking, running) in a database. The user can see all of the…
Georgi Koemdzhiev
  • 11,421
  • 18
  • 62
  • 126
8
votes
1 answer

Questions about the responsbilities of each component in Android Architecture Components

I've been using MVP for a long time now and I'm starting to transfer to a hybrid state between MVP and MVVM In detail my apps will go like this: Each Activity has a 0 to x Fragments that represent its views Each Fragment will request the Activity's…
7
votes
2 answers

Android MVP with view pager

I am trying to implement MVP in my android project. But I am getting difficulty when i implement MVP with viewPagerAdapter. To implement MVP, we used to create fragment/view and presenter instance in Activity class.Fragment/view and presenter both…
6
votes
1 answer

java.lang.IllegalStateException: FragmentManager has not been attached to a host

I am using MVP and have created a callback which is executed when a button is pressed in sign-in screen and the implementations are in the MainActivity where after executing the callback fragment replaces (not working), I've also put a…
Ali
  • 519
  • 4
  • 13
6
votes
2 answers

Why should we use interface in MVP pattern for Android?

I'm making an Android app using Kotlin for the first time using MVP pattern. My questions is, why do I need interfaces for View and Presenter as Kotlin provides higher order functions? Can't we just communicate using those higher order functions? Is…
Mandip Giri
  • 411
  • 3
  • 10
6
votes
2 answers

GoogleMaps using rxJava with MVP

I've an app that from now I have a list filled up from my api. Now I'm detecting the onClick on recyclerView and I want to open a GoogleMaps with a marker focused on the item I clicked (I have lat and long). Is there a good approach to do this with…
StuartDTO
  • 783
  • 7
  • 26
  • 72
6
votes
2 answers

How to pass context to repository in MVP pattern

I have been learning and integrating MVP pattern, and have few questions. What i have understand from this diagram, is that Activity will create instance of Presenter, and pass its reference and model object to the presenter MainPresenter…
6
votes
1 answer

Questions on MVP Pattern for Android apps

I have been developing android apps for few years. Recently i have used MVP architecture in my app and after reading through a lot and making use of this Android10 github repo. But there are few questions i have around this MVP architecture which i…
anshul
  • 982
  • 1
  • 11
  • 33
1
2 3
18 19