Search code examples
androidsqliteandroid-emulatorandroid-2.1-eclair

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


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 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 ?


Solution

  • 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