Java 如何将存储在资产文件夹中的pdf文件共享给Whatsapp

Java 如何将存储在资产文件夹中的pdf文件共享给Whatsapp,java,Java,如何将存储在资产文件夹中的pdf文件共享给Whatsapp path=src/main/assets/alto.pdf ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE}, PackageManager.PERMISSION_GRANTED); StrictM

如何将存储在资产文件夹中的pdf文件共享给Whatsapp

path=src/main/assets/alto.pdf

    ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE}, PackageManager.PERMISSION_GRANTED);
    StrictMode.VmPolicy.Builder bilder=new StrictMode.VmPolicy.Builder();
    StrictMode.setVmPolicy(bilder.build());

    sharebutton=findViewById(R.id.sharebutton);


    sharebutton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            

            File file = new File( "alto.pdf");

          if (!file.exists()){
            Toast.makeText(getApplicationContext(),"no file",Toast.LENGTH_SHORT).show();
            return;
           }Intent intent=new Intent(Intent.ACTION_SEND);
        intent.setType("application/pdf");
        intent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file://"+file));
           startActivity(Intent.createChooser(intent,"share"));

        }
    });