Intent.ACTION_CALL强制关闭

时间:2012-02-12 19:07:33

标签: android android-intent

我正打算打个电话,但我接近了一个力量:

private Uri phonenumbers(int groupPosition, int childPosition) {
     if (groupPosition == 1 && childPosition == 1) return Uri.parse("tel:15555555555");
     return null;
}

textView.setOnClickListener(new View.OnClickListener() {
    public void onClick(View View) {
        Uri uri = phonenumbers(groupPosition, childPosition);                 
        Intent i = new Intent(Intent.ACTION_CALL, uri);
        startActivity(i);
    }
});

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

 String number = "tel:+919966626261";

 Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number)); 
    startActivity(callIntent);

在清单中添加此权限

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

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