2

There is problem in understanding the concept.

I am creating a SQLite sample app in android. currently i am using the path /data/data/packname/databases to store the database.

and there is nothing in my assets folder, i want to know how can i copy the database from my internal path in to assets folder.

Reason:- I want to see database files onupgrade().

I found lots of question related that but not satisfied with the answers .

Any Suggestions

Rahul Baradia
  • 11,802
  • 17
  • 73
  • 121
Monty
  • 3,205
  • 8
  • 36
  • 61

3 Answers3

2

You can't copy anything into your assets folder inside your APK, because APKs can't be changed at runtime.

To do the opposite, that is, package a database in you assets folder and write it to disk, you can use this project: https://github.com/jgilfelt/android-sqlite-asset-helper You use this at development time, not runtime though.

wsanville
  • 37,158
  • 8
  • 76
  • 101
0

You can copy data base from assets folder to your emulator or device at run time. If you want to see your updated data base you have to fetch data base from emulator to your system from

data/data/packagename/databases

I think it is not possible to change data at run time in assets folder. I tried to do that but not success-ed in that. If you found solution post it, so that i can use it.

Manoj Fegde
  • 4,786
  • 15
  • 50
  • 95
0

What i have understanding from your question is your little misconception with how can see SQLite database, so if you have to see your database file then you do not need to save your database in your assets folder.Database file is in the data>data>your application package>database. You can push file from your device and see it. So if you have to see your database then please follow my answer of this question. Where i have briefly describe how can you see you database.

Community
  • 1
  • 1
Pranav P
  • 1,755
  • 19
  • 39