简体   繁体   中英

Comparing SQLite databases on Android

In my application I have an existing SQLite database attached. On start it's copied to phone and then being used. I know how to check if this database is already copied, but I want to check if database on the phone is the same as stored in APK. Is there any way to compare them? I want to do that programmatically.

Original database is stored in assets folder.

If you have a rooted Phone then you can Watch the Details of It. but if your phone is not rooted then you are won't be able to see it.

Another thing if you have copied the Application in your Phone then it will definitely work.

So Conclusion is that If you have a Rooted Phone then you will be able to See and Compare, if possible try to compare its size or Time on which it is Installed.

If you have attach a DataBase with your APK and you successfully copied to your phone that exactly means that you have your old data base copied.So i think no need to compare.If you want to compare then compare all record in Table.

Second if you want to remember that your data base is already copied then use one flag in share preferences.Save true once copied.Then check its value

Updated

To listing all Table

select name from sqlite_master where type = 'table'

If both data base have same table then compare record of these corresponding Table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM