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
  • 29,068
  • 10
  • 64
  • 102

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,496
  • 23
  • 32
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
  • 150,114
  • 66
  • 286
  • 303
Virag Brahme
  • 2,062
  • 1
  • 20
  • 32