How do I determine if Android can handle PDF
Posted
by jasonshah
on Stack Overflow
See other posts from Stack Overflow
or by jasonshah
Published on 2010-05-06T22:04:50Z
Indexed on
2010/05/06
22:08 UTC
Read the original article
Hit count: 196
Hi all, I know Android cannot handle PDFs natively. However, the Nexus One (and possibly other phones) come pre-installed with QuickOffice Viewer. How would I determine whether the user has a PDF viewer installed?
Currently, the code to start the PDF download looks pretty simple:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
After download, the user clicks on the downloaded file to invoke the viewer. However, if there is no PDF viewer, Android reports "Cannot download. The content is not supported on the phone." I want to determine if the user will get this message, and if so, direct them to PDF apps in the Android Market.
Thanks!
© Stack Overflow or respective owner