简体   繁体   中英

Android: TextView with links to online file

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

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM