android:使用内置的 pdf 查看器从我的应用程序打开 pdf

android:使用内置的 pdf 查看器从我的应用程序打开 pdf

问题描述:

这是我最初的问题:

我希望能够打开一个 pdf 文件在我的应用程序中使用 android 的内置pdf 查看器应用程序,但我不知道如何启动其他应用程序.我确定我必须呼叫开始活动,我只是不知道如何识别我打开的应用程序和如何将文件传递给特定的应用程序.

I want to be able to open a pdf file in my app using the android's built in pdf viewer app, but i dont know how to start other apps. I'm sure i have to call start activity, i just dont know how to identify the app im opening and how to pass the file to that specific app.

有人知道吗?

我刚刚了解到我手机上的 pdf 查看器实际上是由 HTC 制作的,而 Adob​​e 刚刚发布了他们的 android pdf 查看器(这很棒).所以新的问题是:我如何验证用户是否安装了 adobe 的查看器,然后我如何从我的应用程序中打开该应用程序中的文件?

I just learned that the pdf viewer i have on my phone is actually made by HTC and that Adobe just barely released their android pdf viewer (which is great). So the new question is this: how do i verify that the user has installed adobe's viewer, and then how do i open the file in that app from my app?

AFAIK,Adobe 没有记录任何它希望开发人员使用的公共 Intent.

AFAIK, Adobe has not documented any public Intents it wants developers to use.

您可以尝试使用 ACTION_VIEW Intent 和指向文件的 Uri(在 SD 卡上或 MODE_WORLD_READABLEcode> 在您的应用程序本地文件存储中)和 "application/pdf" 的 MIME 类型.

You can try an ACTION_VIEW Intent with a Uri pointing to the file (either on the SD card or MODE_WORLD_READABLE in your app-local file store) and a MIME type of "application/pdf".