I was using a database in my app. Now i have the same database but with few more data in it. I have deleted the old database and pasted the new database to the assets folder. Problem is that the app still shows the data which was in the old database. Now i tried emptying the assets folder and tried running the app and the app dint show errors but showed contents from old database. Which means it is stored. Now i want to remove or delete this old database which is copied to the default location and replace it with the new database. How can i do this? NOTE: The old and new database have same database, table and column names.
Asked
Active
Viewed 296 times
0
-
Please goto to setting->Apps Manager and Select app then clear data – sr.farzad Nov 02 '13 at 11:22
-
Whenever you change the schema of the database or simply in case you want to change the data, you can increment the database version (e.g. If you were using 1, you can make it 2) and everything will be recreated. Hope this helps. – jagmohan Nov 02 '13 at 11:26
-
1Or in your app run `Context.deleteDatabase` first to delete the old one. You can also give the database a new version in the dbopenhelper and drop/create all tables. – jboi Nov 02 '13 at 11:29
-
@srfarzad: where can i find the setting? – user2648852 Nov 02 '13 at 11:34
-
i am using a database created using sqlitebrowser. am not sure if i can mention versions to it. – user2648852 Nov 02 '13 at 11:35
-
its copy to /data/data/packagename/database – sr.farzad Nov 02 '13 at 12:00
-
@user2648852 have u achieve ur task i m facing difficulty in it can u please help me – Erum Mar 09 '14 at 18:37
-
@Erum u can uninstall the app from the emulator and re-run the app after replacing ur old database with the new database in the assets folder. – user2648852 Mar 10 '14 at 16:11
-
@user2648852 i want to give apk to the user and user is upgrading database everytime in assets folder .....while database file name is same only version is varying how can i delete old database from real device folder and insert new one i dnt want to delete apk from device – Erum Mar 10 '14 at 17:10
1 Answers
0
Follow This Path...in eclipse...
DDMS--->File Explorer--->data--->data--->Your Packagename--->Database---->Your Databasefile.
just replace this database file to new Database file and build your project....

Abhishek Patel
- 4,280
- 1
- 24
- 38