Question regarding getView() and reference the View in the presenter.
See original GitHub issueThis is simply a question, please label it as such.
I understand getView()
is deprecated. The docs comments on the method mention the following:
/**
* Please, use restartableXX and deliverXX methods for pushing data from RxPresenter into View.
*/
What if an Android Context is needed, in cases like parsing a local .json file
from assets?
For example:
InputStream is = getView().getAssets().open("data.json");
What is the best practice for this particular case?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Android MVP - Should avoid using R.string references in ...
I consider that there's no reason to call any android code in Presenter (But you always can do it). So in your case:...
Read more >Android MVP — An End to if (view != null) - Medium
A Presenter, in an Android app architected using Model View Presenter (MVP), might see its reference to the View become null at any...
Read more >Ted Mosby - Software Architect - Hannes Dorfmann
The view usually has a reference to its presenter. ... the presenter by checking isViewAttached() and using getView() to get the reference.
Read more >Model-View-Presenter implementation thoughts
I was thinking maybe the view should be a static class? Then the dialogs GetView and get the Presenter from there... I'd been...
Read more >Introduction to Automated Android Testing - Part 4
A presenter does not care about how a view shows the results, nor how it shows an error. Similarly, a view doesn't care...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re explicitly avoiding dependency injection for this project. I was considering reading the file into a
String
in the Activity and then just passing the presenter the JSON String, but wanted to determine any alternatives.I need more data on the issue, preferable a minimal repo with reproduced error. Is looks like yet another support library bug for me (I remember they broke view lifecycle inside fragment one day, so this also can be the reason).