The short answer is yes, if you put the following snippet of text in the onUpgrade() method:
try { copyDataBase("database.db"); } catch (IOException e) { Log.w(TAG, e); }
It might be worth deleting the db file in copyDataBase() before writing over it to reduce the chance of corruption.
NB: this uses the implementation used in the accepted answer of a question related to you.
Alex Curran Aug 05 2018-11-11T00: 00Z
source share