-1

In my app i want to add a new feature that consist in having a list of object's bought by the user. So, when the user buy something he add's that object to the list. Later, if he starts the app again,there should be all the items added in the list.

The object will have some parameters (name, bought date, price, etc etc). My question is: is this a case to use sqlite?

If yes, In the activity with the list of the objects, everytime the activity starts I will have to load the table from database?

Thomas Padron-McCarthy
  • 27,232
  • 8
  • 51
  • 75
  • @eldjon yeah, my mistake. Already edited –  Aug 16 '14 at 14:53
  • 1
    @niarb .... If your query is resolved ! ... Accept any one of the answers that helped ! ( Check the green arrow in the answer )... so others also could refer this post ... Happy Coding ! – Devrath Aug 17 '14 at 03:58

2 Answers2

0

The answer to your first question is "yes". The answer to the second is, also, "yes".

G. Blake Meike
  • 6,615
  • 3
  • 24
  • 40
-1

Should I use sqlite?

Well, it depends on your preference and the scenario,

  • If you are using a webserver and updating the webserver, no need to use a sqlite since you can ping a query to server and show the objects for the list
  • If you are not using a webserver you can use Sqlite for this scenario since you can perform all the CRUD(Create,Read,Update,Delete) operations for the Sqlite

Advantages and disadvantages of using SQlite

Pros:

  • If your application gets closed the in memory data will be lost, but after that you will be able to restore the state from the database if you have one
  • Especially for the case of complex calculations it is good to store the result once in the database and not recalculate it multiple times on demand
  • The database will untie your UI from the internet connection and thus you will be able to display results even if there is not internet connection
  • Using database you will be able to fetch the updated data from a background service, without impacting your UI
  • Organizing your data in database usually makes it a lot easier to manage all the application data.

Cons:

  • Adding database will require a bit of additional effort on your side

Sinple Line :: Go for Sqlite solution

Community
  • 1
  • 1
Devrath
  • 42,072
  • 54
  • 195
  • 297