Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify min and/or max length in RemoteInput

I use RemoteInput in my Android N notifications.

I want to set a min and max text length limit for the input.

Google Hangouts got this (i.e. the send button enables when the user entered at least 1 character). Anyone know how this can be done? I've tried to check the Android docs but no luck.

like image 948
Henrik Avatar asked Mar 28 '17 14:03

Henrik


1 Answers

 button.setClickable(false);
    button.setEnabled(false);
    editText = (EditText)findViewById(R.id.editText);


    editText.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            button.setClickable(true);
            button.setTextColor(getResources().getColor(R.color.colorPrimary));
            // TODO Auto-generated method stub
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            // TODO Auto-generated method stub
        }

        @Override
        public void afterTextChanged(Editable s) {

            // TODO Auto-generated method stub
        }
    });



}
like image 183
urvi joshi Avatar answered Oct 30 '22 13:10

urvi joshi