0

In my app would like to load data to sqlite on first time launch only. At the same time would like to animate loading... on the screen until the data is loaded. Upon completion main activity intent can be activated.

Would like to use progressbar if possible.

Thanks

Suresh PB
  • 169
  • 1
  • 2
  • 16
  • What did you try? show your code. – Phantômaxx May 27 '14 at 07:55
  • I wish, I have expertise to think :( Having said that this is my thought:a) create an intent with a text "Loading". b) create an attribute in the manifest to detect first time with value true. c) check the manifest value on OnCreate() of the first intent, if the value is true for firstRun then load and update the text to "Loading..." or animate d) once loading is complete set the value to "False" in the manifest and return to the parent activity. – Suresh PB May 31 '14 at 12:08
  • nonononononono... in the onCreate you check a SharedPreference to see if it is the first time the app runs. If it is, show a Progress Dialog and start an AsycTask to load your data from your CSV - or copy a prefilled db from your assets. In the AsyncTask's onPostExecute, dismiss the progess dialog. Set the firstTimeRun boolean to false in the SharedPreferences. – Phantômaxx May 31 '14 at 12:26
  • can you share the code snippet? – Suresh PB May 31 '14 at 13:33
  • It's a broad argument, don't have a ready-made example code. Try having a look at: http://stackoverflow.com/questions/22985225/display-progress-while-doinbackground then you need a tutorial on SharedPreferences: http://developer.android.com/guide/topics/data/data-storage.html#pref and a tutorial on how to load data from a CSV or how to provide a preloaded database from your assets - put these together and have your app working. It's easier than you might imagine. – Phantômaxx May 31 '14 at 13:42

0 Answers0