My application writes logs to text files, every day, month, year, a new folder with files is created. How can I open the folder with the logs so that the review takes place in the standard viewer?

Just as practice has shown, many users do not have a single file manager, and I have no right to oblige them to install something. We need a working method so that everyone has the opportunity, even without a file manager, to open the folder with the files and view the text logs.

    2 answers 2

    "Standard Viewer" in Android does not exist. So the user may not have any. That is, the only way out is to teach your application to select a file and display its contents.

    You can write yourself a small file manager to select a file or use some sort of library .

    After selecting a file, you can read it and display it in TextView .

      We launch an intent with a file manager (there is a standard one in android) https://stackoverflow.com/questions/9923760/how-to-use-intent-for-choosing-file-browser-to-select-file

      We specify the path to your logs as an argument at startup.

       .... Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("file/*"); startActivityForResult(intent, YOUR_RESULT_CODE); .... 
      • Although the link is a solution, it is better to publish it here. - Alexander Semikashev