1

結果を要求する電話アクティビティを開始しました:

    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;

何か間違っていますか?お知らせ下さい!ありがとうございました

4

1 に答える 1

4

このアクションは結果を返さないと思うので、呼び出しstartActivityForResultは呼び出しと同じですstartActivity

ここに注意してください: 出力 = なし。 http://developer.android.com/reference/android/content/Intent.html#ACTION_CALL

于 2013-12-13T14:45:06.690 に答える