I have download pdf files in my sdcard but when i click them to open in my emulator it gives a toast
"Cannot open file" please help me to read the pdf file .... Please tell me what is wrong in this code.....
File file=new File("/sdcard/Android.Essentials.pdf");
if (file.exists())
{
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);
try {
startActivity(intent);
finish();
}
catch (ActivityNotFoundException e) {
Toast.makeText(PdffileActivity.this,
"No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}