我的程序可以编译并执行它建议的所有内容,但当我尝试使用电话功能时,它会崩溃。我已经更改了 manifest
、Activity
和主类,输入了必要的权限,但它不起作用。错误发生在该代码的第 50 行: https://ideone.com/JrdBrp 。该类名为 StudentCall
。
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED) {
startActivity(it);//line 50
}
}
错误信息是:
“android.content.ActivityNotFoundException:找不到处理 Intent {act = android.intent.action.CALL dat = 电话号码:1} 的 Activity”
。
该类由 MainStudent 类调用,插入以下代码:https://ideone.com/b4jyU6 ,
public void call(View view){
Intent it = new Intent(this, StudentCall.class);
it.putExtra("students", students);
startActivity(it);
}
调用前一个类的函数称为“call”,位于第 31 行。您能帮我一下吗?
最佳答案
Uri uri = Uri.parse("Phone number:" + student.phone_number);
这不是有效的 Uri
。 电话号码:
不是有效的方案,并且 1
不太可能是有效的电话号码。
使用tel:
方案和实际的电话号码。
关于java - 找不到处理 Intent 的 Activity{ act=android.intent.action.CALL dat=电话号码 :1 }?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47254854/