gpt4 book ai didi

Android 将多个号码传递给 SMS Intent

转载 作者:太空宇宙 更新时间:2023-11-03 12:23:05 25 4
gpt4 key购买 nike

我从通讯录中获取不同的号码并将它们传递给 SMS 应用程序。我正在使用以下内容:

Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:"+numbers) );    //numbers separated with ;
intent.putExtra( "sms_body", body );
startActivity( intent );

问题是如果我用'分隔数字; ',它不适用于 Galaxy S,但适用于 HTC、Samsung Gio 等其他产品......在 Galaxy S 上,如果我用逗号 ', ' 分隔数字,它就可以工作。那么如何解决这个问题呢?

最佳答案

通常使用分号(';')分隔电话号码是正确的选择。所以你应该使用这个。例如,可能是由于供应商特定调整或自定义供应商应用程序导致它不适用于 Galaxy S。

除了三星设备,我建议在任何地方都使用分号。不幸的是,您必须在源代码中做出这个丑陋的特定于供应商的决定。

  String separator = "; ";
if(android.os.Build.MANUFACTURER.contains("Samsung")){
separator = ", ";
}
// set the numbers string with the use of 'separator'

关于Android 将多个号码传递给 SMS Intent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9721714/

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