tags:

views:

7

answers:

1

Hi ,I want to execute one method wheneer i enter number in EditText view.But i did not change the focus of EditText.I am stay in the same EditText when i enter a new number automatically i eant to execute one function.Now my question is how we find that event that means enter a new number in EditText

A: 

You need to associate a TextWatcher to your EditText, and then, check in onTextChanged() if the character added was a number. You could use a regular expression for that :

if(s.matches("[0-9]")){
  doYourStuffMethod();
}

You can also use the Matcher class from Android SDK which is an helper for this kind of stuff.

Sephy