How To Determine If Someone Is Typing On Edittext
I am designing a chat application using android studio and i am using fire-base as cloud service provider and i got stock on how to make a listener like if the user is typing on th
Solution 1:
Implement the TextWatcher on your edittext like this
EditTextmyTextBox= (EditText) findViewById(R.id.myTextBox);
myTextBox.addTextChangedListener(newTextWatcher() {
publicvoidafterTextChanged(Editable s) {
}
publicvoidbeforeTextChanged(CharSequence s, int start,
int count, int after) {
}
publicvoidonTextChanged(CharSequence s, int start,
int before, int count) {
// Here you can trigger your another code/function about which you are asking
}
});
Hope it will help!
Solution 2:
you can use OnFocusChangeListener, if the textview has focus then the user is typing. for more information you can check here http://developer.android.com/reference/android/view/View.OnFocusChangeListener.html
Post a Comment for "How To Determine If Someone Is Typing On Edittext"