-2

I am android beginner and I am developing a mobile application which fetches the data from MySQL server when connected to internet but I want to fetch the data in offline for that i need to store the data in SqLite when it is loaded from server.How can I get the data from MySQL and store it in sqlite ,so that whenever I need data it have to fetch from sqlite? please provide me solution

Thanks in advance

bindhu
  • 7
  • 2
  • Take a look to this: http://stackoverflow.com/questions/26706506/android-best-way-to-sync-sqlite-with-mysql and this http://stackoverflow.com/questions/3406891/synchronizing-client-server-databases – adalpari Oct 20 '16 at 11:34

1 Answers1

2

When your application launched first time, fetch the data from the server. It could be in json or xml format. Parse the data and using sqliteopenhelper class store it is local sqlite db. You have to do this on splasscreen. When next time application launch just check whether local data is empty or not. If not fecth data from local db and display it.

Prashant Sable
  • 1,003
  • 7
  • 19