How to share a file in Android programmatically

前端 未结 4 1227
旧时难觅i
旧时难觅i 2020-12-28 19:28

I want to share a file(.pdf,.apk etc) using share Intent, I searched google but I find only the code for sharing Image

Intent sharingIntent = new Intent(Inte         


        
4条回答
  •  余生分开走
    2020-12-28 20:14

    This will help you

    Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    Uri screenshotUri = Uri.parse(path);
    sharingIntent.setType("*/*");
    sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
    startActivity(Intent.createChooser(sharingIntent, "Share using"));
    

提交回复
热议问题