从我的Andr​​oid应用程序调用Adobe Reader的 [英] Invoking Adobe Reader from within my Android application

查看:192
本文介绍了从我的Andr​​oid应用程序调用Adobe Reader的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个Android应用程序,以显示设备上的PDF文件。我需要使用Adobe Reader的当前版本的code(35498)显示files.I与code,显示在屏幕上的文件列表中的PDF格式。现在我需要调用的Adobe阅读器(未安装到设备上的任何其他pdf阅读器)的onclick每个文件。我不知道我是如何code表示。我是一个Android新手。任何帮助将大大AP preciated。

I am writing an Android application to display pdf files on the device. And I need to use the current versioncode (35498) of the Adobe Reader to display the pdf files.I have with code to display list of files on the screen. Now I need to invoke the Adobe reader (not any other pdf reader installed on the device) onclick of each document. I am not sure how I code that. I am an Android newbie. Any help will be greatly appreciated.

在此先感谢, 纳文

推荐答案

我看到你要专门开Adobe公司,但你可能要考虑这样做打开一个总的意图,并允许用户更多的Andr​​oid样的方式选择如何打开。为了您的参考,你会做到这一点与下面的code:

I see that you want to open Adobe specifically, but you may want to consider doing it the more Android-like way of opening a general intent and allowing the user to choose how it opens. For your reference, you'd do that with the following code:

private void openFile(File f, String mimeType)
{
    Intent viewIntent = new Intent();
    viewIntent.setAction(Intent.ACTION_VIEW);
    viewIntent.setDataAndType(Uri.fromFile(file), mimeType);
    // using the packagemanager to query is faster than trying startActivity
    // and catching the activity not found exception, which causes a stack unwind.
    List<ResolveInfo> resolved = getPackageManager().queryIntentActivities(viewIntent, 0);
    if(resolved != null && resolved.size() > 0)
    {
        startActivity(viewIntent);
    }
    else
    {
        // notify the user they can't open it.
    }
}

如果你真的需要同时使用精舍读​​者特别,和特定的版本,你需要查询它使用<一个href="http://developer.android.com/reference/android/content/pm/PackageManager.html#getPackageInfo%28java.lang.String,%20int%29"><$c$c>PackageManager.getPackageInfo(String, INT)

If you really need to use both Abode Reader specifically, and a specific version, you would need to query for it using PackageManager.getPackageInfo(String, int)

这篇关于从我的Andr​​oid应用程序调用Adobe Reader的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆