我的代码是:
x="*141#";
String phoneCallUri =("tel:" + x);
Intent phoneCallIntent = new Intent(Intent.ACTION_DIAL);
phoneCallIntent.setData(Uri.parse(phoneCallUri));
startActivity(phoneCallIntent);
当电话呼叫功能被调用时,它不会使用#only * 141被叫。请帮帮我 在此先感谢
答案 0 :(得分:1)
您应该将第二行更改为:String phoneCallUri = "tel:" + Uri.encode(x);
答案 1 :(得分:1)
#
在Uri中具有空间意义,因此您必须对其进行编码。纠正这个:
x="*141#";
String phoneCallUri =("tel:" + Uri.encode(x));
Intent phoneCallIntent = new Intent(Intent.ACTION_DIAL);
phoneCallIntent.setData(Uri.parse(phoneCallUri));
startActivity(phoneCallIntent);
x="*141#";
Uri uri = Uri.fromParts("tel", x, null);
Intent phoneCallIntent = new Intent(Intent.ACTION_DIAL);
phoneCallIntent.setData(uri);
startActivity(phoneCallIntent);