更新sqlite数据的最佳做法是什么?

时间:2021-03-30 20:03:30

My application does not use internet, though I am using php(json) to get certain data from a local mysql database and parse the JSONObject to Java and save it to sqlite in Android.

我的应用程序不使用互联网,虽然我使用php(json)从本地mysql数据库获取某些数据并将JSONObject解析为Java并将其保存到Android中的sqlite。

I am using this to dynamically populate my android menus from the mysql data(local database). I think this call for a better practice when it comes in getting updates in the database. I will be deleting the previous menu in my sqlite and fetch another data from mysql.

我正在使用它从mysql数据(本地数据库)动态填充我的android菜单。我认为这需要在数据库中获取更新时更好的实践。我将删除我的sqlite中的上一个菜单,并从mysql中获取另一个数据。

1 个解决方案

#1


0  

What I did since I want to update my sqlite database, I incremeted my database version if there are new updated. Also I put an indicator from my outside database so that my app can check if there are available updates.

自从我想更新我的sqlite数据库后我做了什么,如果有新的更新,我会增加我的数据库版本。我还从外部数据库中放了一个指示器,以便我的应用程序可以检查是否有可用的更新。

#1


0  

What I did since I want to update my sqlite database, I incremeted my database version if there are new updated. Also I put an indicator from my outside database so that my app can check if there are available updates.

自从我想更新我的sqlite数据库后我做了什么,如果有新的更新,我会增加我的数据库版本。我还从外部数据库中放了一个指示器,以便我的应用程序可以检查是否有可用的更新。