user1324258
user1324258

Reputation: 561

Getting events when typing on keyboard android

I am developing a chat app for android. I am trying to implement a typing feature so that the chat partner know if the other site is typing.

For this i need to get notified when the smartphone user is typing on the soft keyboard. Is there a some listener to keyboard touch events?

Upvotes: 0

Views: 1251

Answers (1)

user2157571
user2157571

Reputation:

editText.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                // TODO Auto-generated method stub              
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count,
                    int after) {
                // TODO Auto-generated method stub      
            }

            @Override
            public void afterTextChanged(Editable s) {
                // TODO Auto-generated method stub
                status = "Typing"; // where status is a string you send to the other person      
            }
        });

Upvotes: 4

Related Questions