Java 可以将字符串变量设置为调用函数而不使用;电话:";在android中?

Java 可以将字符串变量设置为调用函数而不使用;电话:";在android中?,java,android,Java,Android,我是android开发的新手。 我想像这样向字符串变量添加call函数 TextView c = (TextView) v.findViewById(R.id.email); String playerChanged = c.getText().toString(); Intent call = new Intent(Intent.ACTION_CALL); call.setData(Uri.parse("tel:" + playerChanged )); startActivity(call)

我是android开发的新手。 我想像这样向字符串变量添加call函数

TextView c = (TextView) v.findViewById(R.id.email);
String playerChanged = c.getText().toString();
Intent call = new Intent(Intent.ACTION_CALL);
call.setData(Uri.parse("tel:" + playerChanged ));
startActivity(call);
这里是单列表项。
帮助我。

确保您拥有以下权限:

<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>


还可能需要再次检查您的
playerChanged
值,以确保它实际上是一个电话号码,看起来您是从名为“email”的字段中获取该值的。

您确定从c获取的值(电话号码)正确吗?看起来c是您的电子邮件字段。您遇到了什么样的异常?playerChanged值是123456789。但与此不同,电话:123456789。但我希望将此playerChanged值添加到CallContent.setData(Uri.parse)函数中。
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);