当被叫人想要转发其他人时,我的应用程序会收到错误。这是我的代码博客,我的日志图表无法收到任何错误或警告
public void onCallStateChanged(int state, String incomingNumber) {
if (TelephonyManager.CALL_STATE_RINGING == state) {
ivRedirect.setVisibility(View.VISIBLE);
ivCall.setVisibility(View.INVISIBLE);
}
if (TelephonyManager.CALL_STATE_OFFHOOK == state) {
ivRedirect.setVisibility(View.VISIBLE);
ivCall.setVisibility(View.INVISIBLE);
ivRedirect.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
callForwardString = "*116*" + callForwardString + "#";
Intent intentCallForward = new Intent(Intent.ACTION_CALL); // ACTION_CALL
Uri uri2 = Uri.fromParts("tel", callForwardString, "#");
intentCallForward.setData(uri2);
context.startActivity(intentCallForward);
}
});
}
if (TelephonyManager.CALL_STATE_IDLE == state) {
ivRedirect.setVisibility(View.GONE);
ivCall.setVisibility(View.VISIBLE);
}
}