开发者

Can you transfer a database from an Android device onto your computer to use as database in an Android virtual device

开发者 https://www.devze.com 2023-01-23 09:38 出处:网络
I was wondering: can you transfer a database you use on an Android device onto a virtual Android device in your development environment?

I was wondering: can you transfer a database you use on an Android device onto a virtual Android device in your development environment ?

I am using a program to enter books on my Samsung Galaxy S. From this program I can download the source, which开发者_如何学Python can help me a lot in understanding various aspects of the Android development cycle.

I can compile the program fine and run it to an Android virtual device just fine. But, can I 'download' or 'transfer' the database I created on my mobile onto my pc and than onto the virtual device ?


You can use the Android Debug Bridge

Android Debug Bridge (adb) is a versatile tool lets you manage the state of an emulator instance or Android-powered device.

You can find the adb tool in /platform-tools/.

You will Need to use the pull command on ADB.

It Copies a specified file from an emulator/device instance to your development computer.

If that dosent work for you then use sqlite3 tool.

The sqlite3 tool includes many useful commands, such as .dump to print out the contents of a table and .schema to print the SQL CREATE statement for an existing table.

You can use above commands to get the contents and schema on your development computer. from there you can rebuild the database on your computer.

I hope it helps.

Look here for details


Its quite difficult. The problem is the database on the phone which is not accessible outside of your application. You say you have the source for this program, however it doesnt sound like you have built the version of the code that you are running on the phone. (if you are then you could modify the code to copy the database file /data/data/myapp.com/databases/ onto the sd card and then use adb to get the file back). Note that rebuilding the same application from the same code will not be accepted by Android as the same app, apps are signed.
If your phone is/can be rooted I believe you should be able to again get to the file. Otherwise (hope to be contradicted) I think your stuffed.
The emulator is a lot less restrictive and you can copy files to and from it and shouldn't be a problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号