1

I implemented the MVP pattern and it's working fine.

My understanding:

  1. Presenter must not contain any Android code
  2. Model must not contain any Android code

As result I can mock View and test Presenter and Model independently.

Is my understanding correct? Can Presenter and Model contain/reference android.content.Context ?

Himanshu
  • 2,384
  • 2
  • 24
  • 42
Alex
  • 705
  • 1
  • 9
  • 18
  • what do you need the context for ? And what Context would you pass ? – Blackbelt Dec 04 '17 at 11:53
  • I need context to get file from application cache dir. Something like this: `public static File getAppCacheDir(Context context) { return context.getCacheDir(); }` And method `getAppCacheDir(Context context)` I put to Model. – Alex Dec 04 '17 at 12:39
  • Refer https://stackoverflow.com/questions/39100105/need-context-in-model-in-mvp – Firoz Memon Dec 05 '17 at 07:41

0 Answers0