0
我想添加共享選項到我的soundboard應用程序,現在我遇到了從原始文件夾中獲取音頻文件的問題。如何將音頻文件從原始文件夾共享到社交應用程序?
我試圖使用代碼使共享功能:
public void onClick(View v){
String sharePath = Environment.getExternalStorageDirectory().getPath()
+ "/res/raw/sound1.mp3";
Uri uri = Uri.parse(sharePath);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("audio/*");
share.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(share, "Share Sound File"));
}
但Messenger和其他應用程序都與我的應用程序需要的音頻文件的問題。我應該先創建腳本以將音頻保存在手機存儲中,然後使用該文件在其他應用中共享?