Android捕获OnFocusChange或在警报对话框上启动的最近时间

时间:2012-11-25 00:51:59

标签: java android alertdialog android-alertdialog

我有一个名为'dialog'的警告对话框,但按下最近按钮时不会调用onFocusChange。当有警报对话框时,是否有任何方法可以捕获调用最近按钮?

        final AlertDialog dialog = builder.create();
        dialog.show();  

        enterPin.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {

                    Log.w("com.app", "focus");

                }
                else
                {
                    Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
                    sendBroadcast(closeDialog);
                    Log.w("com.app", "closeDialog");

                }
            }
        });

0 个答案:

没有答案