In my application, I am getting file from assets resources and open pdf file from it. I am using this code:
Uri path = Uri.parse("file:///android_asset/WindsorONE_Mobile_PK.pdf");
Intent intentPDF = new Intent(Intent.ACTION_VIEW);
intentPDF.setDataAndType(path, "application/pdf");
intentPDF.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intentPDF);
}
catch (ActivityNotFoundException e) {
Toast.makeText(ListSample.this,
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
But While I run that code. I got error Dialog that:
"File path is not valid"
So where I am wrong ? Please help me for that.
Thanks.