Android 拨打电话
要实现该功能必须再该项目的AndroidManifest.xml文件添加该permission
<uses-permission android:name="android.permission.CALL_PHONE"/>
在用户点击一个call的button时转换到拨打电话界面+默认电话号码
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button)findViewById(R.id.btn_call);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent callintent = new Intent(Intent.ACTION_DIAL);
callintent.setData(Uri.parse("tel:778899"));
try{
startActivity(callintent);
}catch (SecurityException e){
}
}
});