Android SDcard's Read-only

Source: Internet
Author: User

Androidmanifest.xml whether to join the SDcard permission settings

<!--Create and delete file permissions--
<uses-permission android:name= "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>

<!--Write Data permissions--
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>

Solutions for Android SDcard read-only file system:

Also check your AVD virtual machine for the addition of SD card support!

=============

"Workaround"

A command in the CMD window is available:
ADB shell
Mount-o remount RW/
Other
How to move together let SDcard have read and write permission?

-------------------------------Other issues-----------------------------
To access SDcard in the program, you need to request permission to access SDcard.
The permissions to add access to SDcard in Androidmanifest.xml are as follows:
<!--Create and delete files in SDcard permissions--
<uses-permission android:name= "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<!--write data to sdcard permissions--
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
-------------------------------more about the SDcard problem-------------------------
Why do I need sdcard
The download of images in Android will automatically find space for SDcard, SDcard is also very necessary in the development test.
1: How to load the SDcard in the simulator
The following examples are available through the documentation:
Mksdcard-l sdcard 100M sdcard.img//This will generate a sdcard image file in your PC in the tools directory.

Load SDcard when simulator is started
Emulator-sdcard SDCARD.IMG-AVD MYAVD2
This allows the emulator to see its own sdcard, which can be viewed via the ADB shell.

2: Traverse SDcard
How to find some special path in Android, such as SDcard this special path, actually just look at
Android.os.Environment This class is very clear, which has the following methods:
Getrootdirectory ();
Getdownloadcachedirectory ();
getExternalStorageDirectory ();
Getexternalstoragestate (); Each state of the current sdcard can be obtained.
With the path of the file, you can then use files for a variety of operations such as traversal.

Android SDcard's Read-only

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.