8

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.

Henrik
  • 1,983
  • 3
  • 28
  • 52

2 Answers2

5
 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
        }
    });



}
urvi joshi
  • 158
  • 13
  • How do I get the RemoteInput button as you suggest above: `button.setClickable(false)`? – Henrik Apr 22 '17 at 09:59
  • 2
    Button button = (Button)findViewById(R.id.button2); button.setClickable(false); or you can do it by your xml file. button.setEnable(false) is the important part for you logic. @Henrik – urvi joshi Apr 24 '17 at 06:18
0

Try to implements notification with custom view. And include in it all logic which you need. For me it is one way((

Vova
  • 956
  • 8
  • 22