1

My assets folder : enter image description here

Intent intent = new Intent(this, MyPdfViewerActivity.class); intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "PDF FILE PATH"); startActivity(intent);

How do I get path?

GrIsHu
  • 28,867
  • 10
  • 63
  • 100

2 Answers2

0

Try use:

Intent intent = new Intent(this, MyPdfViewerActivity.class); intent.putExtra(MyPdfViewerActivity.EXTRA_PDFFILENAME, "file:///android_asset/xy.pdf"); startActivity(intent);
Oli
  • 3,436
  • 21
  • 31
0

Try this

 Uri path = Uri.parse("file:///android_asset/about.pdf");
 Intent intent  = new Intent(Intent.ACTION_VIEW);
 intent.setDataAndType(path, "application/pdf");
 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 startActivity(intent);
laalto
  • 144,748
  • 64
  • 275
  • 293
Virag Brahme
  • 2,090
  • 1
  • 20
  • 32