Titanium - Android external storage - create new directory and then write files into it

后端 未结 3 1613
忘了有多久
忘了有多久 2021-01-27 00:30

Can we not simply create new directory programmatically on external SD card (not internal memory of device) in Android and can we not write files on SD card?

Is Titanium

3条回答
  •  误落风尘
    2021-01-27 01:04

    try this create folder and file in sdcard

    File localFile = new File(Environment.getExternalStorageDirectory(),"/data/create_new_folder_name/");
                if (!localFile.exists()) {
                    localFile.mkdir();
                }
                try{
                    File gpxfile = new File(localFile, "yourfilename.xyz");
                    FileWriter writer = new FileWriter(gpxfile,true);
                    writer.append("your file text");
                    writer.flush();
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
    

    manifest.xml permission

     
     
    

提交回复
热议问题