Android dialog 强制弹出输入法

private void showIosDialog(){

        final MyDialog dialog = new MyDialog(context);
              dialog.builder()
                .setMsg("请输入患者手机号")
                .setPositiveButton("确定", new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        tel=dialog.getInput();
                        if (tel.length() != 11) {
                            IosToast.getInstance().showToast(getActivity(), "请输入正确的手机号");
                            return;
                        }
                        if(!BaseTools.isMobileNO(tel))
                        {
                             IosToast.getInstance().showToast(getActivity(), "请输入正确的手机号");
                                return;
                        }
                       findPatient(tel);
                    }
                }).setNegativeButton("取消", new OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        dialog.show();
        Timer timer = new Timer();  
        timer.schedule(new TimerTask() {  

            @Override  
            public void run() {  
                InputMethodManager inManager = (InputMethodManager)dialog.gerInputEdit().getContext().getSystemService(Context.INPUT_METHOD_SERVICE); 
                inManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);  
            }  
        }, 200);  
        dialog.setInput(true);
        dialog.setNegativeButtonTextColor(context.getResources().getColor(R.color.actionsheet_blue))
                .setPositiveButtonEnable(true);

        }

你可能感兴趣的:(Android)