Android Download Directory

1

Hello, in my app I download a CSV file, but it never appears in the Downloads of the smartphone, I can only see if it is with the File Manager. And also when I try to pass the file to the computer, I can not find the directory that was saved. The file path is this /storage/emulated/0/Download/16hrs.csv . How do I show the file on my smartphone downloads and how do I get this file from my computer? obg

private File getStorageDir(String fileName) {
    return new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS), fileName);
}
File f = getStorageDir(fileName);
FileWriter mFileWriter = null;

mFileWriter = new FileWriter(filePath , true);
writer = new CSVWriter(mFileWriter,';',' ');

String[] dTitle = {"Academia","Data", "Turma","Aluno","Piscinas","Metros","Tempo"};

writer.writeNext(dTitle);
writer.close();
mFileWriter.close();
    
asked by anonymous 24.08.2015 / 22:10

1 answer

1

To get the correct path of the android downloads folder use the following code:

 File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
    
11.09.2015 / 21:37