Popular Posts

There was an error in this gadget

Apr 27, 2012

Create sub-folder in SD Card using Java code (Android)


First  in AndroidManifest.xml add the permission  "android.permission.WRITE_EXTERNAL_STORAGE"
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

The java code:
 String subDir = "/myFolderName";
      String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
      File myNewFolder = new File(extStorageDirectory + subDir);
      myNewFolder.mkdir();

No comments:

Post a Comment