日志文章

2020-1-11 aflfte2011

Android拨打电话操作

1 Android直接拨打电话

 Intent Intent =  new Intent(Intent.ACTION_CALL,Uri.parse("tel:" + phoneNumber));//直接拨打电话
 startActivity(Intent);

2 Android跳转到拨号界面

 Intent Intent =  new Intent(Intent.ACTION_CALL_BUTTON);//跳转到拨号界面
 startActivity(Intent);

3 Android跳转到拨号界面,同时传递电话号码

 Intent Intent =  new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + phoneNumber));//跳转到拨号界面,同时传递电话号码
 startActivity(Intent);
注:如果是直接拨打电话,记得要加入权限<uses-permission android:name="android.permission.CALL_PHONE" /> 

« 安卓锁定横屏或竖屏 | AlertDialog提示消息的使用方法»