tags:

views:

45

answers:

1

I have a class that creates a view to gather data via a function getView() that provides a view with an EditText.

This class has also has variable answer. When the user chances the EditText I want to store the content of the EditText in answer.

If I would use an onKeyListener I fear that the answer will probably get stored before the last letter is entered.

Is there a good way to handle this in the getView() function via some other listener?

+1  A: 

You should addTextChangedListener to your EditText and implement in your class TextWatcher

Then you will just take the text from the methods and store in your answer

Pentium10
Thanks, I missed it because I thought such a function would have to be named setTextChangedListener :(
Christian
Probably there is a good reason they call it `add` and not `set`. Probably they let us to add more listeneres than one (in case of using set)
Pentium10