0

I work with Android and I want to open PDF file:

  1. from URL
  2. from Internal storage.(where put my file to Android read it?)

Can somebody help me?

mindia
  • 6,991
  • 4
  • 22
  • 20

1 Answers1

3

Assuming there is a PDF viewer application installed on the device

To open the PDF in application use:

Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

where file is the path of PDF File.

Ayush
  • 3,989
  • 1
  • 26
  • 34