gpt4 book ai didi

android - 如何在 Android 4.0+ 中发送带附件的彩信

转载 作者:行者123 更新时间:2023-11-30 02:35:28 24 4
gpt4 key购买 nike

如何在 Android 4.0+ 中发送带附件的彩信?我尝试这样:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/png");
sendIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse(outputFile.toURL().toString()));
startActivity(sendIntent);

它在 htc 和 samsung 中运行良好,但在 Nexus 5(环聊)中不起作用。我尝试这样:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra("address", phonesBuilder2.toString());
sendIntent.putExtra("sms_body", editTextTPMessage.getText());
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(makePicture()));

但是文件没有附加。我尝试了很多方法,但所有方法都有问题。

最佳答案

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "Hi how are you"); //Version dependent
intent.putExtra(Intent.EXTRA_TEXT, "Hi how are you"); //Version dependent
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/file.gif")));
intent.setType("image/gif");
startActivity(Intent.createChooser(intent,"Send"));

关于android - 如何在 Android 4.0+ 中发送带附件的彩信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26636824/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com