In my android app, i create a sqlite database in onCreate() method and it is filled with informations that i get from a csv file on my server.
My problem is that everytime the app is launched, my db is filled with same information once again (so if the app is launched 3 times i will have my db filled 3 times with same data).
First launch:
ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
Second:
ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
Third:
ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
3 Paul 32 California 20000.0
4 Allen 25 Texas 15000.0
5 Paul 32 California 20000.0
6 Allen 25 Texas 15000.0
How can i handle this situation? I would like that my db would be filled only if data in csv are not in the db.
Any idea?
0 comments:
Post a Comment