Search code examples
androiddesign-patternsandroid-mvp

MVP pattern temporary data storage


I am working on an application in which different screens need to load data from API. Like there is a details screen that needs to load data from API on the basis of id passed to it. I am passing id to fragment in bundle created by newInstance method. I am implementing my app according to MVP pattern and am a bit confused that where should I store this id in view or presenter. I also need some temporary variables to keep track of whether data was loaded or not because I am loading data on onStart event on fragment


Solution

  • Obviously you should store id in presenter.

    Anyway you load data from API inside presenter. If you need to get that id in Activity you can get if from presenter.