Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I have some items in my ubuntu 12.04 desktop. I want to transfer them into the Sdcard of one of the avds in my android emulator (android-sdk-linux) which I have installed on the same system.

Like to know how to do the above.

share|improve this question
3  
It would certainly help if you could describe the type of your "items" a bit closer: are you talking about files, or other elements? Not everything visible on the Ubuntu desktop can be transfered to Android (well, except in a screenshot ;) –  Izzy Dec 17 '12 at 8:48
    
Those are files. –  Host-website-on-iPage Dec 17 '12 at 11:19

2 Answers 2

up vote 5 down vote accepted

1. Using command line: Here's how you can copy files to an SD card image.

You have to use adb push to copy files from Desktop to Emulator and adb pull for the reverse. Here's the syntax to copy files to or from an Emulator/Device Instance:

Copy from desktop to emulator:

adb push <local> <remote>

Copy from emulator to desktop:

adb pull <remote> <local>

Here <local> is path of file / folder on your desktop and <remote> is path of file / folder on your emulator.

Here is an example:

adb push foo.txt /sdcard/foo.txt

foo.txt will be pushed (copied) to the emulator.


2. Using DDMS UI: Here's how to work with emulator's file system using DDMS.

  1. In the Devices tab, select the emulator that you want to view the file system for.
  2. To copy a file from the device, locate the file in the File Explorer and click the Pull file button.
  3. To copy a file to the device, click the Push file button on the File Explorer tab.

I personally prefer the adb pull and adb push commands as you can copy multiple files (in a single directory) with just one line command, using DDMS you can copy only one file at a time (no directory).

share|improve this answer

To transfer data from desktop to an emulator's SdCard on Linux do this:

  • Create the SD Card:

Let's create a 64MB sd card for our Android emulator. From a terminal do this:

# cd ~/android-sdk-linux/tools
# ./mksdcard 64M ~/Desktop/sdcard.iso
  • Now you can use the 'Eclipse Android SDK and AVD Manager' to create a new Android virtual device that can use the path to the sd card you created.

  • Write Data to the SD Card:

From a terminal:

# cd ~/android-sdk-linux/tools
# ./ddms
  • This will start the Dalvik Debug Monitor Server. Then:

    1. Launch your AVD with SD card from Eclipse that you created earlier
    2. From DDMS, go to 'Device -> File Explorer'
    3. Select the 'sdcard' folder
    4. Click the 'push file onto device' button
    5. Find your file and click open
    6. That's it!

Now from inside your code you can get to the sd card's path with:

Environment.getExternalStorageDirectory()

More you can read here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.