String str = mPhone.getText().toString();
if (PhoneNumberUtils.isGlobalPhoneNumber(str)) {
String sPhone = "tel://" + str;
Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse(sPhone));
startActivity(i);
} else {
Toast.makeText(main.this, "不能拨号", Toast.LENGTH_LONG).show();
}
android拨打电话
最新推荐文章于 2025-09-17 00:15:00 发布
本文介绍了一段用于检查电话号码格式并尝试拨打电话的Android代码片段。如果输入的电话号码符合全球电话号码格式,则会启动拨号应用;否则将显示错误提示。
199

被折叠的 条评论
为什么被折叠?



