Android SD card usage instructions

Source: Internet
Author: User

I recently made a music player and needed to add mp3 files to the SD card. The following describes how to use sdcard.
The Android simulator allows us to use the disk image in fat32 format as the SD card simulation:
All of the following operations are performed in windows
1. Create an image file
Run cmd to enter the Tools directory of the android SDK and run mksdcard to create the SDK.
For example, my tools directory is:
1. E: \ skyland \ android-sdk-windows-1.0_r2 \ tools>
Then:
1. E: \ skyland \ android-sdk-windows-1.0_r2 \ tools> mksdcard 128 M sdcard. img
The first parameter is the size of the sdcard to be created (determined by the size), and the second parameter is the name of the sdcard.
2. Start the Android simulator www.2cto.com with sdcard
On the Dos interface,
1. E: \ skylands \ android-sdk-windows-1.0_r2 \ tools> emulator-sdcard. img
In this way, a folder named sdcard. img. lock is generated dynamically under the tools directory, and disappears when the simulator is disabled.
Note: Do not close this Dos window. Otherwise, the simulator will be closed and the subsequent step cannot be executed.
3. Add a file to sdcard
In addition, to open a Dos window (cmd), you still need to cd it to the Tools directory of the android SDK, and use the adb push command to add
1. E: \ skyland \ android-sdk-windows-1.0_r2 \ tools> adb push new. JPG/sdcard
The first parameter is the full name of the image (mp3) to be added. If there is a space in the name, enclose it with double quotation marks.
For example:
1. E: \ skyland \ android-sdk-windows-1.0_r2 \ tools> adb push "First startcard"/sdcard
The second parameter is the newly created sdcard.
4. view the added file
In this step, you may need to restart the Android simulator with sdcard to view the resource file you just added. That is, you must first turn off the simulator.
Then
1. E: \ skylands \ android-sdk-windows-1.0_r2 \ tools> emulator-sdcard. img
 
Use sdcard in Eclipse
If the. imgfile is not created, go back to the beginning and do step 2.
Note: If you do not start the simulator in step 1 but do the following, an error is reported indicating that the SDK card is a read-only file and cannot be added.
1. Start Eclipse and choose Window> Perspective> other> DDMS.
Select the sdcard and click push to add the image resources to the sdcard.
2. Use sdcard resources to compile Android scripts
If you need to use sdcard resources when compiling Android applications
Right-click
1. Run As --> Open Run Dialog --> Target
Add the startup parameter to the Aditional Emulator Command Line Options of the Target tag.
1.-sdcard E: \ skyland \ android-sdk-windows-1.0_r2 \ tools \ sdcard
Use the File Explorer File Browser in the ddms label to transfer
 


 
Note that when importing data to the sdcard of the simulator, the error "Failed to push selection: Invalid argument" is often reported because of poor Chinese support, you only need to remove the Chinese characters of the file name to be imported and change them to English letters. In addition, there should be no spaces in the name.
Author: wangjinyu501
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.