I have an android app in which users have sets of items, and each item has about 10 properties.
What I do at the moment:
- items are stored in the server database
- when the user logs in, I get all the items (say 37) via the API and put them in a LinkedHashSet< UserItem > (UserItem is a POJO with setters and getters)
- then I get the 37 items from the set and put them in the local SQLite database
- when the user opens "My Items" screen in the app, i get the 37 items from the local SQLite DB
I was thinking, is this a good practice? Could I circumvent Step 3(storing items in the local database), but instead maintain the life of that LinkedHashSet object and get the items directly from there. If Im right with this suggestion, how do I do that?
I asked a similar question at Stack Overflow but I was told that I should come here and ask it.