How can I make sdcard have the read and write permissions together?
------------------------------- Other questions -----------------------------
InProgramTo access sdcard, you need to apply for the permission to access sdcard.
The permission to access sdcard in androidmanifest. XML is as follows:
<! -- Create and delete file permissions in sdcard -->
<Uses-Permission Android: Name = "android. Permission. mount_unmount_filesystems"/>
<! -- Write data to sdcard -->
<Uses-Permission Android: Name = "android. Permission. write_external_storage"/>
------------------------------- More about sdcard -------------------------
Why sdcard?
In Android, image downloads on webpages will automatically search for space from sdcard. sdcard is also necessary for development and testing.
1: how to load sdcard in the simulator
This document provides the following examples:
Mksdcard-l sdcard 100 m sdcard. IMG // This will generate an image file of the sdcard in the PC under the tools directory.
Load sdcard when the simulator starts
Emulator-sdcard. IMG-AVD myavd2
In this way, the simulator will be able to see its own sdcard, And you can log on to view it through the ADB shell.
2: traverse sdcard
How can we find some special paths in Android, such as sdcard?
The android. OS. Environment class is very clear, including the following methods:
Getrootdirectory ();
Getdownloadcachedirectory ();
Getexternalstoragedirectory ();
Getexternalstoragestate (); obtains the status of the current sdcard.
Environment. getexternalstoragestate (). Equals (environment. media_mounted) ---- determine whether the sdcard status is available
with the file path, you can use file for various traversal operations.