我试着通过WhatsApp的共享MP3文件。它可以与其他应用程序(如Gmail)完美协作,但它可以在whatsapp上运行。谁能帮我?我需要添加一些putExtra()吗?Intent.ACTION_SEND WhatsApp的
这里是我的代码:
public void shareWithFriends(int id)
{
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("audio/mp3");
//share.putExtra(Intent.EXTRA_SUBJECT,"subject");
//Uri uri = Uri.parse("android.resource://com.igs.pokemonsoundboard/" + id);
Uri uri = Uri.parse("android.resource://com.igs.pokemonsoundboard/raw/" + R.raw.pikachump3);
share.putExtra(Intent.EXTRA_STREAM,uri);
//share.putExtra("sms_body","Ringtone File :");
startActivity(Intent.createChooser(share, "Share sound"));
}
感谢;)
此代码不适用于我,即使我已将该文件保存在“sdcard”中,但我收到'无法发送,请重试'消息 – 2014-12-17 11:19:20