android pdf

来源:互联网 发布:豆豆 背叛 知乎 编辑:程序博客网 时间:2024/05/15 10:52

Intent intent = new Intent();

  //intent.addCategory("android.intent.category.DEFAULT");

  
  intent.setAction(android.content.Intent.ACTION_VIEW);

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

  intent.setDataAndType(uri, "application/pdf");
  
  //Intent intent2 = new Intent(); 
  //intent2.setAction(Intent.ACTION_CHOOSER); 
  //intent2.putExtra(Intent.EXTRA_TITLE, "请选择能够打开pdf的应用"); 
  //intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  //intent2.putExtra(Intent.EXTRA_INTENT, intent); 
  ComponentName componetName = new ComponentName(  
                //这个是另外一个应用程序的包名  
                "com.chaozh.iReaderFree",  
                 //这个是要启动的Activity  
                 "com.chaozh.iReader.ui.activity.WelcomeActivity");  
          intent.setComponent(componetName);  
          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         // startActivity(intent);  
         
         System.out.println( android.os.Build.MODEL+"," + android.os.Build.VERSION.SDK + ","+ android.os.Build.VERSION.RELEASE);

0 0