sockeqwe / mosby

A Model-View-Presenter / Model-View-Intent library for modern Android apps
http://hannesdorfmann.com/mosby/
Apache License 2.0
5.49k stars 841 forks source link

MvpLceActivity errorView overrides another MvpLceActivity #178

Closed JonathanSanchezSalas closed 7 years ago

JonathanSanchezSalas commented 7 years ago

Hi. I need your help to try to find what is happening to my Android app. I'm using Mosby. This is the flow to explain my issue:

  1. I have an activity. It extends from MvpLceActivity, to show data from WebService. It works OK. If error occurs it shows errorView. Nothing new about this.

  2. Activity has a menu button to show a list of new items. This menu option creates a new Intent. The class I called from this intent extends from MvpLceActivity too. This activity calls a WebService to show some data. it works good.

  3. The issue I found is that: If occurs one error in this last activity, I mean, if errorView is visible, when I press back, then in my first activity that was showing another data, it shows errorView too. I need to reload view to show the data again. This is why I say that errorView overrides another MvpLceActivity. If data is loaded whithout error, first activity keeps the data.

I shared a sequence of images to simulate the problem.

Any detail just let me know

Thank you 1 2 3

sockeqwe commented 7 years ago

That sounds really strange, but I'm pretty sure that this is not mosby related per se. I.e. does both screens use the same "model" object? if yes, then this one may inform both presenters of both activities accidentally? Or do you use an Eventbus which triggers displaying an errorview somehow?

I would suggest to set a breakpoint in your Activity showError() method to see when this method will be triggered. Then you see the call hierarchy in debugger and you can trace back who and why has caused the activity to show the error view.

JonathanSanchezSalas commented 7 years ago

Hi Hannes. Thanks a lot for time to try to help me. You were right. I'm using EventBus, and both activities were subscribed to the same event when error occurred. As you pointed, solution was to change events for both activities. I really appreciate your knowledge. Thank you.