Create the SD Card...
For instance, if you want to load MP3 files on a “real” Android phone, you’ll probably insert an SD card into the phone. The emulator can emulate this, but you need to jump through a few hoops:Let's create a 64MB sd card for our Android emulator, shall we?
Linux
From a terminal...
# cd ~/android-sdk-linux/tools # ./mksdcard 64M ~/Desktop/sdcard.isoWindows XP
From a DOS prompt...
Actually where is your android-sdk-windows exists.
cd C:\Program Files\android-sdk-windows\tools mksdcard 64M c:\documents and settings\tyler\desktop\sdcard.isoNow 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...
LinuxFrom a terminal...
# cd ~/android-sdk-linux/tools # ./ddmsWindows XP
From a DOS prompt...
cd C:\Program Files\android-sdk-windows\tools ddmsThis will start the Dalvik Debug Monitor Server. Next...
- Launch your AVD with SD card from Eclipse that you created earlier
- From DDMS, go to 'Device -> File Explorer'
- Select the 'sdcard' folder
- Click the 'push file onto device' button
- Find your file and click open
Now from inside your code you can get to the sd card's path with: Environment.getExternalStorageDirectory()