当前位置:首页 > Android使用Intent打开拨号界面

Android使用Intent打开拨号界面

点击次数:3942  更新日期:2016-05-04

首先,需要添加权限

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

1)直接拨打电话

Intent intentPhone = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));

startActivity(intentPhone);

2)跳转到拨号界面,不拨打

Intent intent = newIntent(Intent.ACTION_DIAL,Uri.parse("tel:" + phoneNumber));

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(intent);