Make directory in android

后端 未结 8 693
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 17:40

Im trying to build a directory called \"images\" on the SD card on android. This is my code but its not working? Can anyone give me some advice?

File picDire         


        
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 18:29

    This should help.
    First get the path of the external storage:

    File root=Environment.getExternalStorageDirectory();
    

    Then:

    File picDirectory = new File(root.getAbsolutePath(), "mnt/sdcard/images");
    picDirectory.mkdirs();           
    

提交回复
热议问题