본문 바로가기
IT/Android

Android] Textview TextWatcher 자동 콤마

by 깻잎쌈 2023. 6. 20.
반응형

https://onlyfor-me-blog.tistory.com/435

 

[Android] TextWatcher란?

앱을 만들다 보면 editText에 입력한 값을 실시간으로 관찰하면서 입력값에 따른 처리를 해야 할 때가 있다. 그 때 가볍게 써먹을 수 있는 편리한 TextWatcher란 인터페이스가 있다. 이름부터 뭘 하는

onlyfor-me-blog.tistory.com

 

editText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                Log.e(TAG, "beforeTextChanged() - charSequence : " + charSequence);
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                Log.e(TAG, "onTextChanged() - charSequence : " + charSequence);
            }

            @Override
            public void afterTextChanged(Editable editable) {
                Log.e(TAG, "afterTextChanged() - editable : " + editable.toString());
            }
        });

 

https://h5bak.tistory.com/131

 

안드로이드(Android) TextWatcher(comma)

안드로이드 EditText에서 글 입력 시 이벤트를 설정하여 함수를 실행할 수 있습니다. 아래는 소스는 숫자 입력 시 3자리마다 컴마(comma)를 출력/삭제하는 예제입니다. @Override public void onCreate(Bundle sa

h5bak.tistory.com

 

반응형

댓글