Android - Creating a folder in the data/data/pkg/files directory

前端 未结 1 1915
梦谈多话
梦谈多话 2020-12-31 22:11

Referencing this question:

How to create files hierarchy in Androids '/data/data/pkg/files' directory?

What kind of a solution is there to this probl

相关标签:
1条回答
  • 2020-12-31 22:17

    getContext().getDir() method is your friend

    File dir = ctx.getDir("my_sub_dir", Context.MODE_PRIVATE);
    File newfile = new File(topDirFile.getAbsolutePath() + File.separator + "new_file_name");
    newfile.createNewFile();
    BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream(newfile), 16 * 1024);
    
    0 讨论(0)
提交回复
热议问题