jeudi 14 janvier 2016

Where to put code for Sample data in Android?

I have build an android application where I call the method insertSampleData() from the onCreate() method of main activity.

The problem is that onCreate() method is called every-time the app is launched, this results in filling my database with a lot of sample data.

I want to provide sample data only once when the application is installed. Can anyone please tell me how to do it ? Thanks a lot !

P.S: The method insertSampleData() is used to insert sample data into Sq-lite database.

Aucun commentaire:

Enregistrer un commentaire