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. 为什么编程都带点强迫症?
  2. 工作中线程的启动
  3. 数学相关函数在PHP中的应用简介
  4. 软件测试人员需不需懂代码
  5. 回答两个被频繁问到的代码写法问题
  6. synchronized和Lock
  7. git学习记录
  8. ElasticSearch API & 文档 curd 操作
  9. Elasticsearch aggs 聚合
  10. 版本管理·玩转git(快速入门git)