Your Uri is invalid. Please use a valid path to your file. On Wed, Dec 29, 2010 at 2:56 AM, Robin Talwar <r.o.b.i.n.abhis...@gmail.com> wrote: > This is my onclick code > > public void onClick(View v) { > // TODO Auto-generated method stub > Intent i = new Intent(); > i.setAction(Intent.ACTION_VIEW); > > i.setDataAndType(Uri.parse("file:///raw/unlockingandroid.pdg"), > "application/pdf"); > try{ > startActivity(i); > } > catch (ActivityNotFoundException e) { > Toast.makeText(pdfviewer.this, > "No Application Available to View PDF", > Toast.LENGTH_SHORT).show(); > } > > } > > I see a toast when i click the button :( i cant see the pdf > > On Wed, Dec 29, 2010 at 12:26 PM, Jake Basile <jakerbas...@gmail.com> wrote: >> >> Just like opening any other type of file on Android, you should try to >> launch an intent to view it. >> Intent openPdfIntent = new Intent(); >> intent.setAction(Intent.ACTION_VIEW); >> intent.setDataAndType(Uri.fromFile(pdfFile), "application/pdf"); >> try >> { >> startIntent(openPdfIntent); >> } >> catch(ActivityNotFoundException e) >> { >> // No app can open PDF files on their phone. >> } >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en
-- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en