How to get EditText value to textview at the time of typing without button click in android [closed]

穿精又带淫゛_ 提交于 2021-02-19 07:48:26

问题


How to read data from EditText to textview at user input without button click


回答1:


Try using textwatcher on Edittext and update textview using available methods.

TextWatcher textWatcher = new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int 
            count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }
};

textView.addTextChangedListener(textWatcher);



回答2:


You can add a textwatcher on your edit text, and update your textview from there.



来源:https://stackoverflow.com/questions/48067033/how-to-get-edittext-value-to-textview-at-the-time-of-typing-without-button-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!