2

I have a [CDATA] string that has a (a href) link in it which links to PDF file online (http://online.link.com/file.pdf). I can make the TextView clickable in the area of the link, no problem, but the thing is that I want it to open a ACTION_VIEW intent to view the PDF file locally with the PDF viewer. Is this possible?

Thanks

user584513
  • 630
  • 11
  • 20

2 Answers2

0

It's Possible :). Go through through the following links.

http://asmncl.blogspot.in/2012/06/android-open-pdf-file-in-webview.html

Render a PDF file using Java on Android

May this solves your problem.

Community
  • 1
  • 1
Shalini
  • 1,733
  • 4
  • 17
  • 31
  • No. The URL is in TextView, it leads to online pdf file, and when it's clicked I want not a browser to open but an Intent to show the PDF within the app. Like handling the clicks over links in TextView. (and without using OnClickListener over the whole TextView). – user584513 Sep 25 '12 at 09:01
0

Yes, you can use Intents like below.

Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri
                        .parse("file://" + aFile.getAbsolutePath()));
startActivity(myIntent);

PDF files will be opened in default phone viewer. I am not really sure if it works on emulator. Have it a go anyway!

Renjith
  • 3,457
  • 5
  • 46
  • 67