-5

I have a .PDF file saved on my sdcard. I need to read the content of .PDF file and show it in a TextView.

How do I do this?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

You could use something like this for example - get the file path and open it as a new intent:

// get the file path from the external storage (SD card)
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/yourPdfName.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW);
// set the content type and data of the intent
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
// start the intent as a new activity
startActivity(intent);
Gabriella Angelova
  • 2,985
  • 1
  • 17
  • 30