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

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();
             }
 
         }
  }


你可能感兴趣的:(Android)