I am writing an application that will have a JSON file that contains data that needs to be parsed and stored in ItemModel POJOs.
Suppose for now I have a simple Activity that doesnβt display anything - all I want my application to do is to parse JSON at startup and create model objects (I would like to find out the basic architecture of these items before move on to big / better things). I would like to unit test this code before creating any user interface components to make sure my model classes work fine.
So ItemModel is obviously a model object.
Where does JSON parsing fall in terms of MVP? A library for data analysis ( Gson , Jackson or something else?) Gson certainly require an Android Context for this, so should I parse this information into Activity ? If so, now the view knows about Model classes, which violates MVP.
Also, if I wanted them to ItemModel / JSON data in a database, where would this be done? The database should technically be in the model, but this requires Context to work correctly ...
Any thoughts? Thanks!
source share