Creating folder in internal Memory to save files and retrieve them later

后端 未结 1 1417
南方客
南方客 2020-12-05 16:26

I want to make a folder in the Internal Memory in my application to store Audio Files,then check if the exist to do some operations. How to make this folde, in which path, a

相关标签:
1条回答
  • 2020-12-05 17:08
    File mydir = context.getDir("mydir", Context.MODE_PRIVATE); //Creating an internal dir;
    File fileWithinMyDir = new File(mydir, "myfile"); //Getting a file within the dir.
    FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file
    

    For deleting a file from internal :

    if (new File("path/to/file").delete()) {
      // Deleted
    } else {
      // Not deleted
    }
    
    0 讨论(0)
提交回复
热议问题