Android 将文件从原始文件夹共享到其他应用

Android 将文件从原始文件夹共享到其他应用,android,share,Android,Share,我想通过SharingContent将声音从原始文件夹共享到另一个应用程序 我使用此代码共享文本和字符串 Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "Here is the share content body"; sharingIntent.putExtra(a

我想通过SharingContent将声音从原始文件夹共享到另一个应用程序

我使用此代码共享文本和字符串

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    String shareBody = "Here is the share content body";
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
    sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
    startActivity(Intent.createChooser(sharingIntent, "Share via"));

您可以使用
Uri
通过替换来共享您的文件

sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
相反,解析一个
URI

sharingIntent.putExtra(
     Intent.EXTRA_STREAM, 
     Uri.parse("android.resource://" + this.getPackageName() + "/raw/" + name
));