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
EditText myTextBox = (EditText) findViewById(R.id.myTextBox);
myTextBox.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
}
public void onTextChanged(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"