How to create a directory in Android?

前端 未结 4 970
礼貌的吻别
礼貌的吻别 2021-01-13 05:16

Everything is in the question. Here is my code :

    private void createDirectory(File currentDirectory) {
  File f = null;
  try {

   f = new File(current         


        
4条回答
  •  -上瘾入骨i
    2021-01-13 05:27

    instead of boolean success = f.mkdir(); use

    boolean success = f.mkdirs();
    

    that solved my problem (i used the same reference code as you and had the same issue).

提交回复
热议问题