简体   繁体   English

android应用升级到新版本后如何保留旧数据库?

[英]How to retain the older database after the android app is upgraded to new version?

我只是希望用户即使在将应用程序升级到应用程序的新版本之后仍保留其较旧的数据库。是否可以,如果可以的话。请帮助我是菜鸟吗?

It is version of db in constructor as mentioned below which tells whether app is going to update database or not. 如下所述,它是构造函数中db的版本,它告诉应用程序是否要更新数据库。 So it is not dependent on the the version of app . 因此,它不依赖于app的版本。 So if you haven't update the db version then not a problem for users who upgrade the app. 因此,如果您尚未更新数据库版本,那么对于升级该应用程序的用户来说就不是问题。

public class TimeTrackerDatabase extends SQLiteOpenHelper {

    public TimeTrackerDatabase(Context context){
        super(context, "dbname.db", null, DB_Version);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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