[android-beginners] Re: getting length of an EditText while entering text

2009-09-29 Thread Justin Anderson
One way would be to subclass the EditText class...  You would then have
access to onTextChanged and could do whatever you want with it.

Thanks,
Justin

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Tue, Sep 29, 2009 at 2:07 PM, infero inf...@infero.ch wrote:


 I'd like to display the length of the entered text for a EditText
 while the user is typing, so he/she can see when the maximum
 characters are reached - or the other way round how many chars are
 left (link for an SMS).

 I see that the TextView has a protected method onTextChanged, but how
 can I make the activity get informed about a change, so I can update
 the text?

 href to that method:

 http://developer.android.com/reference/android/widget/TextView.html#onTextChanged(java.lang.CharSequencehttp://developer.android.com/reference/android/widget/TextView.html#onTextChanged%28java.lang.CharSequence
 ,
 int, int, int)

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: getting length of an EditText while entering text

2009-09-29 Thread infero

 One way would be to subclass the EditText class...  You would then have
 access to onTextChanged and could do whatever you want with it.

Thanks Justin,
That sounds like a big overhead :-( for something quite simple.
I hope there is somehow a simpler way available...

Regards
infero
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: getting length of an EditText while entering text

2009-09-29 Thread Justin Anderson
And indeed there is... My last post was without referencing the docs.
However there is this:

addTextChangedListener(TextWatcher watcher)

Hope that helps.

Thanks,
Justin
--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Tue, Sep 29, 2009 at 2:27 PM, infero inf...@infero.ch wrote:


  One way would be to subclass the EditText class...  You would then have
  access to onTextChanged and could do whatever you want with it.

 Thanks Justin,
 That sounds like a big overhead :-( for something quite simple.
 I hope there is somehow a simpler way available...

 Regards
 infero
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---