A Safe Path to External Storage

前端 未结 5 1646
暗喜
暗喜 2020-12-22 11:14

For my app, I have a fairly large database that needs to be stored on the user\'s device. I plan to change this in the future. For now, however, I\'d like to store it to the

5条回答
  •  盖世英雄少女心
    2020-12-22 12:17

    I use

    File rootPath = Environment.getExternalStorageDirectory();
    String StorageDir = new File(rootPath.getPath()+"/"+DirectoryName);
    

    where DirectoryName is the name of the subdirectory in the ExternalStorage to use. No one has reported any issues to me.

提交回复
热议问题