当前位置:操作系统 > 安卓/Android >>

下载并打开PDF格式文件2----用指定的software

 

用指定的software来打开PDF格式文件,在我的项目中是用AdobeReader来打开。

 

So

 

 

public Intent getPdfFileIntent(String path){ 

        Intent i = new Intent(Intent.ACTION_VIEW); 

        i.addCategory(Intent.CATEGORY_DEFAULT); 

        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK ); 

        Uri uri = Uri.fromFile(new File(path)); 

        i.setDataAndType(uri, "application/pdf"); 

        ComponentName app = new ComponentName("com.adobe.reader", "com.adobe.reader.AdobeReader");<span style="color:#990000;">//The add line to specify the software!!!</span> 

        i.setComponent(app); 

        return i; 

    }   

 

 


摘自 欧阳天涵的专栏
补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,