I'm trying to save an html file in the Download folder, I can save without problems, but I can not see it in the Downloads Android application, I tried to find some way to display the file in the application, but have not found how. I'm saving this way:
File Download =
Environment.getExternalStoragePublicDirectory
(Environment.DIRECTORY_DOWNLOADS);
File mapsDir = new File(Download, getString(R.string.folder_name));
boolean dirCreat = mapsDir.mkdir();
...
File file = new File(mapsDir,getString(R.string.file_name));
...
byte [] htmlByte=html.getBytes();
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
bos.write(htmlByte);
bos.flush();
bos.close();
Intent intent =
new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
intent.setData(Uri.fromFile(file));
context.sendBroadcast(intent);
I saw this: Android DownloadManager save to Download folder
But I can't apply this to my problem
I know that the file is saved as through the Astro app I can view it.
And I need to show the file in this App.
I am using a nexus 4 with android 4.4.
Thanks to anyone who can help.