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

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Then how can i put my db file in assets.
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.

1 Comment

what you want ,you are giving ans or asking the question.
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.