Create a folder on sdcard in Android, androidsdcard

Source: Internet
Author: User

Create a folder on sdcard in Android, androidsdcard

// Create a folder on the SD card
Public void createSDCardDir (){
If (Environment. MEDIA_MOUNTED.equals (Environment. getExternalStorageState ())){
// Create a folder object and assign it to the directory of the External Storage
File sdcardDir = Environment. getExternalStorageDirectory ();
// Get a path with the folder path and name of the sdcard
String path = sdcardDir. getPath () + "/cardImages ";
File path1 = new File (path );
If (! Path1.exists ()){
// If the directory does not exist, you can create a directory when the application starts.
Path1.mkdirs ();
SetTitle ("paht OK, path:" + path );
}
}
Else {
SetTitle ("false ");
Return;

}

}

(To: http://blog.csdn.net/yun90/article/details/7611723)

 

Personal note: Create a built-in SDCard instead of an extended (external) SDCard

<! -- Write data to sdcard -->
<Uses-permission android: name = "android. permission. WRITE_EXTERNAL_STORAGE"> </uses-permission>
<! -- Create/delete object permissions in sdcard -->
<Uses-permission android: name = "android. permission. MOUNT_UNMOUNT_FILESYSTEMS"> </uses-permission>

Related Article

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.