how to view the pdf file in my emulator
android, pdf
Solution
To launch an Intent on a PDF file, the mobile device should have installed a program that can read PDF documents.
If you do not want the user to have a PDF reader's installed, you must modify your application to be able to read PDF documents.
On this post talk about PDF libraries for Android: Android : Is there any free PDF library for Android
Problem
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(); } ```