want to create folder in sdcard on AVD

前端 未结 4 1129
刺人心
刺人心 2021-01-05 01:23

I want to create folder in sdcard. i am using following command in android terminal

cd sdcard mkdir music

mkdir failed for music, Permission denied.

4条回答
  •  隐瞒了意图╮
    2021-01-05 02:11

    While creating a directory, it is better to provide complete path instead of using cd

    Use Environment.getExternalStorageDirectory() to get the storage root directory.

    Use the following command to create directory:

    String filepath=Environment.getExternalStorageDirectory()+"/Music"
    File fc=new File(filepath)
    if(!fc.exists())       
            fc.mkdir();
    

提交回复
热议问题