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
4
votes
1 answer

Dagger 2 For Android "cannot be provided without an @Provides-annotated method"

I'm trying to use the latest version of Dagger 2 V2.11 for Android Here is my code: AppComponent: @Singleton @Component(modules = { AndroidInjectionModule.class, AppModule.class, ActivityBuildersModule.class, …
Ibrahim Disouki
  • 2,642
  • 4
  • 21
  • 52
4
votes
0 answers

Firebase and Dagger2 Dependency Injection

I'm building an app following an MVP pattern where I create each presenter using Dagger2 and all is well. I went with Firebase and I noticed that in each of my presenters, I have the same dependencies Database Database…
4
votes
0 answers

Which layer should be responsible for Notification management in Android MVP?

I'm sure that it shouldn't be handled by any View or Presenter coupled with Activity because they are not present when app is running in the background. Is it a good idea to treat notifications as another View with a singleton Presenter?
I60R
  • 467
  • 2
  • 14
4
votes
1 answer

Nested MVP on Android: how to

I am working on an Android test project composed of 3 main parts, each of which developed following the MVP pattern. These parts are nested into each other and I would like to know if the strategy I am following is the correct/best one or…
kioli
  • 635
  • 1
  • 10
  • 26
4
votes
2 answers

Android | Dagger 2. Injecting different subclasses into Fragment depending of a condition

I am working with MVP and Dagger 2 DI. I have a Fragment that I reuse in a few activities. I have an interface type for presenter as a property of the Fragment, say MVPPresenter. Depending in which activity the Fragment is being used, I need to…
Sermilion
  • 1,920
  • 3
  • 35
  • 54
3
votes
0 answers

Is it okay to use objects which implement Parcelable in Presenters?

Is it okay to use objects which implement Parcelable in Presenters? If i have some object in presenter that implements Parcelable does it means that my presenter depends on android sdk object(Parcelable)?
Outofdate
  • 635
  • 5
  • 16
3
votes
1 answer

LifecycleRegistry not getting initialized, in the BaseActivity for MVP architecture

I have the few Base classes defined for my Activity and Fragment, Presenter, and ViewHolder, and ViewModel, and an interface and Presenter being defined, All other activities inheriting these base classes, and In my BaseActivity class and…
Gaurav
  • 533
  • 5
  • 20
3
votes
0 answers

@subcomponent.factory method is missing parameters for required modules or subcomponents

I am injecting Presenter to BookDashboard(Activity) and BookDashboardPresenter class require an MvpView interface in it's constructor . When i run AppComponent @Component( modules = [ AndroidInjectionModule::class, …
Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300
3
votes
2 answers

Android MVP with Volley

I have the following problem. I want to implement MVP with Android, using Volley as a model. The problem is, that Volley requestQueue need context. I know that one solution is to make a static Context, but it's a bad practice. How should I create…
Spongi
  • 501
  • 3
  • 10
  • 19
3
votes
1 answer

Use Kotlin higher order functions in MVP

Normally with Java, we make a *Contract interface to handle interaction between View and Presenter, like: MainActivity As View public class MainActivity extends Activity implements MainContract { @Override public void onCreate(Bundle b) { …
Mahdi-Malv
  • 16,677
  • 10
  • 70
  • 117
3
votes
1 answer

Firebase remote config Unit Test in Android MVP?

Is there any example about unit test of firebase remote config in android? Below code in our presenter and we want to write unit test for it. And why there is no enough source about unit test? @Override public void fetchFirebaseRemoteConfig() { …
3
votes
1 answer

How can I pass a listener from a Fragment to a DialogFragment?

I'm currently working in a single activity application that is using fragments for each screen. I'm also using MVP design pattern. Context I have a Fragment (Fragment-A) in which I have a List of Items. This Fragment handles the actions for each…
3
votes
2 answers

Should unit tests cover constants changing?

I am creating a unit test for my presenter. I have 2 constants for a ranges which definitely can be in future changed to a requests from server. So I wrote all my code in the way that it will work with any value of this constants. And now I have…
3
votes
1 answer

Mockito test in MVP pattern

I'm trying to unit test my Presenter class using Mockito and I always end up failing the test: org.mockito.exceptions.base.MockitoException: Cannot mock/spy class java.lang.String Mockito cannot mock/spy following: - final classes - anonymous…
AJ Seraspi
  • 113
  • 1
  • 14
3
votes
2 answers

Mockito wanted but not invoked - However, there was exactly 1 interaction with this mock

This is the first time I use mockito & roboelectric to make unit test on android studio. I want to verify that view.onSuccessLogin() called when request to server / API is success. But, I got an error "wanted but not invoked - However, there was…
Maulana Firdaus
  • 125
  • 2
  • 6
1 2
3
18 19