问题是我没有收到任何错误,但它也没有拨打电话。它在Android KitKat上工作正常,但在我的Lenovo Lollipop(5.0)上没有。
try {
String contact_number="1234567891";
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + contact_number));
startActivity(callIntent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(),e.toString(),Toast.LENGTH_SHORT).show();
}
在清单文件中,我声明了:
<uses-permission android:name="android.permission.CALL_PHONE" />