I have an App that downloads a PDF file and stores it with MODE_PRIVATE (for security purposes) on the Internal Memory of the App:
FileOutputStream fos = get
How can I open and display the downloaded PDF file?
Create a ContentProvider
to serve the PDF file, then use an ACTION_VIEW
Intent
with the Uri
to your ContentProvider
to open it in the user's chosen PDF viewer.
This sample project demonstrates how to serve a PDF file from internal storage.
To make a file from internal storage available to other apps the cleanest approach is to use a content provider. Luckily, Android comes with FileProvider – an implementation that might just serve your needs. You don't need to implement code (contrary to the approach of @CommonsWare), you just need to specifiy the provider in your manifest.