I write a file to Environment.DIRECTORY_DOWNLOADS, why can't I see it via the Downloads App?

前端 未结 5 998
余生分开走
余生分开走 2020-12-03 11:45

I write (write, not download, to be precise it is the dump of a SQLite db of my App) a file on the Environment.DIRECTORY_DOWNLOADS directory.

File path = Env         


        
5条回答
  •  春和景丽
    2020-12-03 12:06

    you just created File instance like

    File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    File file = new File(path, "db.csv");
    

    but the file "db.csv" is not created yet. use

    file.createNewFile();
    

    to create the file "db.csv" really...

提交回复
热议问题