我开始致电请求结果的电话:
Intent intentcall = new Intent();
intentcall.setAction(Intent.ACTION_CALL);
intentcall.setData(Uri.parse("tel:" + phoneNumber));
this.startActivityForResult(intentcall, REQUEST_SLIPDROP_ICON_OFF);
然后将结果设置为电话呼叫监听器,如下所示:
private class MyPhoneStateListener extends PhoneStateListener{
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
setResult(Activity.RESULT_OK);
break;
最后,我想关闭onActivityResult中的图标,但没有任何反应。
switch (requestCode) {
case REQUEST_SLIPDROP_ICON_OFF:
Log.d("request icon off", "request icon off");
if (resultCode == Activity.RESULT_OK) {
changeMenuItem(R.id.fall, R.drawable.fall);
slipAndDropIconOn = false;
}
break;
有什么不对吗?请指教!谢谢
答案 0 :(得分:4)
我认为此操作不会返回结果,因此调用startActivityForResult
与调用startActivity
请注意:输出=无。 http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL