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

How to Access the Fragment Manager (or the Hosting Activity) from the Presenter

I need to access the fragment manager (or activity) from my presenter. How can I access it? The presenter itself is being called from another presenter which in turn is called from a fragment. How can I access the fragment manager or the hosting…
burakk
  • 1,231
  • 2
  • 22
  • 45
0
votes
1 answer

Subscriber onNext is called before completion of the asynchronous requests in rxjava2

I have implemented a repository pattern in MVP using RxJava2 RemoteDataSource.java public Observable> getAList(){ return ApiService. getAList() .compose(RxUtils.applySchedulers()) …
robin_24
  • 109
  • 2
  • 9
0
votes
1 answer

How is the presenter created in MVP?

I was looking at the google samples for MVP and I saw this as the last statement in onCreate of the activity: new TaskDetailPresenter( taskId, Injection.provideTasksRepository(getApplicationContext()), …
Jim
  • 3,845
  • 3
  • 22
  • 47
0
votes
1 answer

RecyclerView not showing anything even after receiving data

I am trying to populate some data on a RecyclerView. The data is obtained in one of the ways: Request data from an API if internet is present (using Retrofit and RxJava2), persist the data to local database (using Room), send the data to the View…
Shankha057
  • 1,296
  • 1
  • 20
  • 38
0
votes
1 answer

Dagger 2 + MVP - single presenter assigned to multiple fragments

I would like to implement a part of an application that takes some steps that would be handled by one presenter. I have declared one scope: @Scope annotation class FormScope next, I wanted to declare a module that would provide necessary…
Patryk Jabłoński
  • 697
  • 10
  • 29
0
votes
1 answer

Dagger2 - Cross-Module Dependecy

I'm trying to build a simple cross-module dependency with Dagger2. When I rebuild the project, all DaggerComponents go down. I have the genereal application dependency injection package for the Application: Component - General…
Bruno Neuman
  • 128
  • 1
  • 10
0
votes
0 answers

Adding a Second Presenter to the ArrayObjectAdapter Instance

I am using my custom fragment instead of the RowsFragment in my Android TV app which implements the leanback library. The custom fragment consists of two equally sized horizontal LinearLayouts (upper and lower halves of the screen) in a FrameLayout.…
burakk
  • 1,231
  • 2
  • 22
  • 45
0
votes
1 answer

RxJava thread not waiting for result

I have this method that I am trying to pull data from an API, and then update the text view. Everything works except getRecipeName doesn't finish after the "end Method" log. .getRecipeName() uses RetroFit to pull from an API. I am currently learning…
C. Skjerdal
  • 2,750
  • 3
  • 25
  • 50
0
votes
1 answer

How to test reading from/updating file in MVP?

I'm trying to change my app from having no design pattern to using MVP. Originally I had the following code: override fun onCreateInputView(): View { //favoritesData is an instance variable, same with "Gson", "parser", "favorites", and…
Foobar
  • 7,458
  • 16
  • 81
  • 161
0
votes
1 answer

Multiple Fragments(Views) and Presenters with a single activity (MVP)

I'm developing an Android application using the MVP pattern which uses Firebase Services and Firebase Authentication. In the authentication module, I have three fragments(views) - a) Intro Screen fragment, b) Sign In Fragment and c) Sign Up…
0
votes
2 answers

Access to items layout from RxAndroid?

I am using the code below: mCompositeDisposable.add(myObservable(IdLang, shortTermCoursesModels) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribeWith(new…
user4813855
0
votes
3 answers

MVP and data loading

The code I will quote is from an app that is quite similar to googlecodelabs/android-testing. For a number of reasons, We want to follow the MVP pattern, so we want to respect the dependency inversion principle and never make the Presenter know…
Achraf Amil
  • 1,275
  • 16
  • 20
0
votes
1 answer

List in a RecycleView's adapter appears sometime, failed other time

I ran into a quite evasive issue when developing an android app. The app is a client of a cryptocurrency RESTFul service. In its simplest form, it fetches the information of a range of virtual coins and display them in a list, presented using a…
J.E.Y
  • 1,173
  • 2
  • 15
  • 37
0
votes
2 answers

Android - NPE when using FragmentPagerAdapter and rotating device

I am trying to implement an MVP architecture by following Google's sample todo app The problem I have is that I am getting a NPE when starting my presenter in the onResume() of the fragments. This happens when I change the orientation of the…
0
votes
1 answer

Robolectric 3.8 with MVP and mocking setupActivity()

I use Android MVP architecture and I want to test my View. I have the following code in my project: @RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21) public class MainActivityTest { @Test public void…
Michał Dobi Dobrzański
  • 1,449
  • 1
  • 20
  • 19