Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

finishComposingText on inactive InputConnection

i tried to use alertdialog for input somethings,but when i click editText system will display "W/IInputConnectionWrapper: finishComposingText on inactive InputConnection".

test1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
            View mView = getLayoutInflater().inflate(R.layout.dk, null);
            final AlertDialog dialog = mBuilder.create();
            final EditText day = (EditText) mView.findViewById(R.id.day);
            final EditText month = (EditText) mView.findViewById(R.id.month);
            final EditText year = (EditText) mView.findViewById(R.id.year);
            final Button bu1 = (Button) mView.findViewById(R.id.bu1);


            bu1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
               #code


                 dialog.dismiss();
                }

            });

            dialog.setView(mView);

            dialog.show();

        }
    });
like image 204
Kai SHeng Avatar asked Nov 08 '22 01:11

Kai SHeng


1 Answers

Is it possible that the EditText is wrapped inside a TextInputLayout? If so, you receive this message the moment the animation of the hint-text is finsihed.

This is not really the issue here. The issue is that the onClick is not triggered the first time for EditText views. The first click is used to set the focus on the EditText view. The second click will trigger the onClick event, which will show your dialog.

You can fix this by setting the android:focusableInTouchMode parameter of the EditText object on false

android:focusableInTouchMode="false"
like image 159
Mathias Monstrey Avatar answered Nov 15 '22 08:11

Mathias Monstrey