How to Apply the Textchange event on EditText

前端 未结 7 1258
感动是毒
感动是毒 2020-12-13 13:38

I developed one simple app, like subtraction, addition. In this app I use three EditTexts, one for answer and other two for question. I want to calculate the answer of quest

相关标签:
7条回答
  • 2020-12-13 14:32

    I had the same issue and the problem was solved with these 2 actions:
    1 - android:inputType="textNoSuggestions" (it did not solve the problem itself)
    2 - adding the listener:

    edittext1.addTextChangedListener(new TextWatcher() {
    
                public void onTextChanged(CharSequence s, int start, int before,
                int count) {
    
                    Log.e("JFT", "EDITTEXT => = "+s);
                    if(!s.equals("") ) {
                        //do your work here
                    }
                }
    
    
    
                public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
    
                }
    
                public void afterTextChanged(Editable s) {
    
                }
            });
    
    0 讨论(0)
提交回复
热议问题