http://blog.jayway.com/2009/04/22/working-with-sd-cards-in-the-android-emulator/

Working with SD cards in the Android emulator

April 22nd, 2009 by Mårten Österberg — Android, Embedded
Mårten Österberg

Working with external storage in the Android emulator could be a little tricky and the documentation is not easy to find. I'll try to give a brief walk through of the steps needed to create a SD card image, mount the image in Linux, put content on it and use it in the emulator.

Creating a SD card image
In both the 1.1 and 1.5 version of the SDK there is a tool called mksdcard located in the SDK Install Dir/tools folder. Simply run

./mksdcard 128M my128MbCard

to create a 128Mb SD card with the name my128MbCard.

Mounting a SD card image in Linux
To be able to put content on to the card you can mount the card in Linux. It will then simply appear as a folder in the filesystem.
First make a directory in the /media folder:

sudo mkdir /media/mycard

Then mount the card as a loopback device:

sudo mount -o loop my128MbCard /media/mycard

Adding content to the card
With content we usually mean media content like images and videos. Images and videos are located in a folder called /dcim/Camera. You could of course add any content to the card. When you are done copying your files be sure to umount the card otherwise it will not be usable from the emulator.

sudo umount /media/mycard/

Using the card in the emulator
Google added something called Android Virtual Device (AVD) to the SDK 1.5. To create a new AVD using our newly created SDcard image run the following:

./android create avd --name myAVD --target 2 --sdcard my128MbCard

Target 2 means that we want to use the 1.5 API features in the device. Now we simply fire up the emulator and start using our content:

./emulator -avd myAVD

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android Service AIDL 远程调用服务之简
  2. Android开发AsyncTask异步处理任务
  3. 《宅男的android开发指南》(翻译)--4
  4. Android四大核心组件之一-----Service(服
  5. 旋屏时,OnCreate方法重复调用的解决
  6. Android焦点问题
  7. Android源码下载出现的问题
  8. SpannableString的使用方法
  9. 重磅出击,Google Android经典资料!
  10. Android的加速度传感器模拟摇一摇的效果-