All Questions
259 questions
0
votes
0
answers
39
views
How to implement Model View Presenter in Android Java?
// Presenter interface
public interface MainPresenter {
void loadData();
}
// View interface
public interface MainView {
void showData(String data);
void showError(String message);
}
// ...
2
votes
0
answers
142
views
Guice and MVP pattern: decouple the view from the presenter
I'm writing an application in Swing and I'd like to make use of Model–view–presenter pattern. I found a sample application using this pattern and then I alter it to make use of Guice to do dependency ...
0
votes
3
answers
908
views
Best way to run a function only after two concurrent process ends?
I have several concurrent processes which finish at varying times, I would like to run a function only after all of those processes end.
I have thought of the following solution, but it isn't exactly ...
0
votes
1
answer
218
views
Retrofit Android : How To Get JSON Data With Retrofit MVP
Please Guys I'm confused about how to retrieve data using retrofit with MVP architecture, I already try other steps but not worked for me, can you help me? I'm still learning to use retrofit with MVP ...
0
votes
0
answers
32
views
How to handle controller/views creation in a custom MVC
I'm on an application which should open a GUI specific commands.
I tried to implement a sort of MVC like that (simplified version) :
class View1 {
// Delegate gui framework
private Gui delegate;
...
0
votes
0
answers
348
views
How to handle Different JSON response from same endpoint
I have the following json structure for successful response.
{
"status": "Successful",
"data": [
{
"A": "apple",
"B": &...
0
votes
1
answer
460
views
How do I use Repository pattern and Interactor pattern in a Model View Presenter pattern?
I am developing an application with the help of Model View Presenter pattern.
I make use of Retrofit and so I have a ApiClient and ApiInterface with endpoints. I implement the interface in a ...
0
votes
1
answer
82
views
Learning MVP for Android and not sure what I am doing wrong
I am learning MVP for Android. I built a simple app that uses RecyclerView, Retrofit and I am using the free Pokemon API to load Pokemon names. Below is my code. Please let me know what I am doing ...
1
vote
2
answers
425
views
MVP Android: how to pass data from one activity to another?
I have the following doubt and I'm wondering if this breaks or not the MVP pattern.
My project has Activity1 where an user can fill a form and then the presenter, related to that activity, on a ...
0
votes
1
answer
802
views
How to use Room without breaking the MVP pattern?
I'm using a Room database in my app and I'm trying to follow the MVP pattern, so I want to use a presenter to call functions that perform database operations. An android application Context is needed ...
1
vote
2
answers
2k
views
More than one presenter in view class in MVP model [duplicate]
I'm using MVP model to develop a finance management app in Android Studio.
I have two spinners and some kind of month picker (so to speak) to show transactions that have happened in that month.
So it'...
1
vote
1
answer
133
views
Is there a way to cleanly avoid duplicate code in this instance?
I'm working on android with Java and I'm implementing the Model-View-Presenter architecture. There are two types of games the player can play:
Game A
Game B
Both games are really similar but with ...
0
votes
0
answers
101
views
NullPointer Exception on AndroidX SearchView
I have an application currently set up with the MVP architecture. I have the presenter set up like so:
package com.example.test;
// Declaration of packages
import androidx.appcompat.widget....
0
votes
1
answer
1k
views
I can not understand clean architecture's part (MVP) from uncle Bob book
I read "Clean Architecture book" by uncle Bob. And I tried to implement simple examples. I have this diagram:
I can not understand how can I implement part in the red line. For example, I have a ...
2
votes
2
answers
787
views
MVP Clean Architecture - where do calculation and non data related tasks belong?
I've been doing a lot of research and trying to use MVP with Clean Architecture in my app, but still i have a lot of confusion and don't understand it completely. My biggest doubt is: where should non ...
0
votes
1
answer
1k
views
OpenCV on Android: net.forward yields "215 Assertion failed"
Following this tutorial from openCV, and it should be straight forward. However, it crashes with an assertion fail on the net.forward, that I cannot resolve/find anywhere else.
Thought this problem ...
1
vote
1
answer
370
views
Should I create Presenter and Model for each Activity or not?
I've read some articles about using MVP pattern in Android. The best way for me is to create contract(one interface for each Model,View and Presenter).
The question is should I create such a contract ...
0
votes
3
answers
5k
views
Made a custom Adapter for my RecyclerView with a List
I want to make a custom Adapter for my RecyclerView because I need to use a custom method inside who will init my List later when my presenter will be ready:
public void setList(List<Object>...
0
votes
1
answer
49
views
How I should get the data in the Repository from an API
I have a call to the api who emits a Single and I want to get access from the Repository for later observe it in the Interactor
Here is my call:
@GET("reviews")
@NonNull Single<Response<...
1
vote
3
answers
279
views
Display AlertDialog in a View after observing a completable
I want to display an AlertDialog in my View showing that the result was successful,
private void actionUpdateProfesional() {
btnSave.setOnClickListener(view -> {
alertDialog = new ...
0
votes
4
answers
156
views
Dagger2 Error at inject in a class who injects
I'm trying to inject in my presenter an interactor but gives me an error, at seems I can't inject in a class who injects to another:
error: [Dagger/DuplicateBindings] com.example.calculadora.Data....
0
votes
0
answers
134
views
Javafx drag and drop, putting elements in array when drop is done?
I have created an array that represents positions in a gridpane.
I am trying to put strings(that represent the Image) in an array when a images is dropped in the grid on that position.
My problem is ...
0
votes
1
answer
364
views
Changing scene in javaFX while using MVP model
So I'm using javaFX for a school project and I'm trying to change scene in my primary window but I HAVE to use the MVP model so I have to set an event handler to changing the scene inside of the ...
0
votes
1
answer
40
views
How should different MVPs share the data
Imagine I have got two 'components' following MVP pattern:
1: MyTableMVP (responsible to list Persons in table)
2: MyFormMVP (responsible to show Person in form)
Could you kindly help me to find ...
0
votes
1
answer
478
views
Android MVP best way to handle views with API call
I am having a question regarding how do I update my view or perform a fragment transition when the view goes to background and the API response comes as a callback.
For example I have a loginfragment....
0
votes
0
answers
624
views
RxJava2 success always called twice
I'm implementing an MVP architecture with Retrofit, and RxJava2 (with RxAndroid). I have the following setup
NetworkInterface.java where retrofit calls lie
public interface NetworkInterface {
@...
8
votes
2
answers
4k
views
Using coroutines in a right way
I am implementing the coroutine for first time. I am following MVP pattern for a simple login app. Here is my code flow -
The login button clicked will follow this direction -
LoginFragment -> ...
5
votes
0
answers
164
views
MVP - Presenter comparision: view injected in constructor vs takeView(View v) / dropView()
I've seen two approaches to MVP pattern in Android. Both are used in Android Architecture Blueprints:
public interface Contract {
interface View {
void showData(String data);
}
...
0
votes
0
answers
32
views
passing objects in mvp arch
I work with MVP Architecture I get information through an API. In the MODEL LEVEL, I have List I want to pass this List into PRESENTER LEVEL.
When I create a function to resolve this issue I got an ...
1
vote
1
answer
905
views
understanding leaks in android MVP
I've read some similar questions on here but due to the lack of code presented I'm not certain my question describes the same scenarios.
I hope that the following snippets and questions will help ...
0
votes
0
answers
68
views
how do I make rxjava pagination
I am trying to add pagination to my rest call here, and I have looked at many tuts but I don't know how I make pagination from this call in my Presenter, so I can handle pages from my REST API? in my ...
-1
votes
1
answer
880
views
Testing an android mvp presenter
What's the best way to test my mvp presenter? I've read a ton of tutorials and each one makes me even more confused. I'm just starting to learn about testing and I figured it'd be easier to start with ...
2
votes
2
answers
949
views
Android MVP - Share Preference
I started to learn MVP but I have a few questions related the SharedPreferences, as far as I know if I want to save a value in the sharedPreferences I need to pass this value to the presenter and the ...
2
votes
4
answers
337
views
Android MVP - Calls the server
I started to learn MVP but I have a few questions related the communication between the Model and the Presenter, for example a login feature
Activity will get all the fields, send to the presenter, ...
1
vote
1
answer
342
views
Package structure for MVP android project
So I have a project where I use MVP architecture. I have trouble deciding how to structure it. My idea is to separate them by feature but where should I put the model classes. So for exemple:
...
0
votes
0
answers
42
views
An activity is supposedly destroyed. Yet, It's recreated by android without me explicitly starting it?
So, I'm facing a strange behavior. I'm implementing MVP design pattern in my app.
I have 2 activities, A and B.
The presenter of activity A is listening to a socket connection to the server.
In the ...
0
votes
1
answer
446
views
How to implement MVP Passive View?
I'm currently working on a desktop application using JavaFX (Please note that I'm not using the Screen Builder, I create my view directly in the coding). I would like to implement the Passive View ...
0
votes
1
answer
233
views
Google Maps MVP Android
I'm using Google Maps on my app so I'd like to know a different way to do my goal. My goal is every time user joins a street it should call an api saying hey I'm in, so my question is, what's better ...
0
votes
1
answer
278
views
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....
7
votes
1
answer
457
views
Avoiding cast in generic factory-based MVP framework
I was trying to implement a way to decouple View and Presenter in the MVP pattern to provide a framework, which does exactly this, but after a point I got confused.
Background
I have a View ...
0
votes
1
answer
1k
views
ShowDialog using MVP
I have a view called ILoginView and on it I have a showDialog(String message) and on my LoginPresenter I have the call to api so if it fails I do view.showDialog(context.getString(R.string....
3
votes
1
answer
1k
views
MVP to MVVM Android
One guy from here told me that MVVM is better than MVP he told me many pros and many conts, but I'd like to know if my MVP is well done or if you know any other way maybe to convert to MVVM.
It's a ...
-1
votes
1
answer
2k
views
Login MVP with retrofit
Hi I'm trying to create a simple app where use the retrofit library to make a call to the api to make the login and I'd like to use the MVP pattern, could anyone of you guide to how to do it, since I'...
0
votes
3
answers
803
views
Android MVP - where should i read from Textview?
After a user clicks a button i want to read what's in the TextViews of the activity and then call a method from the presenter to get a return based on the info sent to it.
However i don't know if ...
2
votes
1
answer
437
views
Presenter Instructing Current Activity to Inflate Next Activity; Violation of MVP Rules or Not
Considering the fact that in Android, you need a package context to be able to inflate the next activity from the current activity using an intent. However, with the MVP, the presenter is meant to be ...
2
votes
1
answer
1k
views
Multiple Activities Implementing Same Listener
I know there are similar questions but it still doesn't answer my question in the manner I need for my current situation.
I have three activity presenters that each need to call a certain data ...
4
votes
1
answer
1k
views
Android MVP Proper Way to Release Presenter
I am working with MVP architecture and I'm stuck on how to proper release the presenter. First, let me tell you guys what is happening.
PROBLEM
1) My presenter make an async server request.
2) When ...
0
votes
1
answer
391
views
how to emit error then emit the cached data using RxJava?
I am using RxJava in a MVP solution and I want to achieve this scenario:
try to get the server data and if its successful populate the view using server data
if its unsuccessful for any reason (no ...
1
vote
1
answer
135
views
Creating a Basic MVP Android App
public class MainActivity extends AppCompatActivity {
//text
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
0
votes
2
answers
205
views
Activity or Fragment as View on MVP [closed]
I'm trying to know which is the better implementation of the view on MVP.
For example in small Apps, It's better to use one or two activity's and use as a View the Fragments? or It's better use one ...