MVP pattern temporary data storage

时间:2018-02-03 11:24:06

标签: android design-patterns android-mvp

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

1 个答案:

答案 0 :(得分:1)

显然,您应该在演示者中存储 id

无论如何,您从演示者内部的API加载数据。如果您需要在活动中获得 id ,则可以从演示者那里获得。