android 调用第三方软件打开pdf文件

来源:互联网 发布:结束单身 知乎 编辑:程序博客网 时间:2024/05/29 08:16
public void openPDFReader(int index) {  if (dataList != null && dataList.size() > index) {   CoverFlowData tempData = dataList.get(index);//   Log.v("wenjianming>>>>>>>>>>", Global.magazinePath+tempData.name+".pdf");         File file = new File(Global.magazinePath+tempData.name+".pdf");         if (file.exists()) {             Uri path = Uri.fromFile(file);             Intent intent = new Intent(Intent.ACTION_VIEW);             intent.setDataAndType(path, "application/pdf");             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);             try {                 startActivity(intent);             }             catch (ActivityNotFoundException e) {                 Toast.makeText(ActivityCoverFlow.this,                     "No Application Available to View PDF",                     Toast.LENGTH_SHORT).show();             }          }  }


2 1
原创粉丝点击