Skip to content
Advertisement

Tag: textview

android on Text Change Listener

I have a situation, where there are two fields. field1 and field2. All I want to do is empty field2 when field1 is changed and vice versa. So at the end only one field has content on it. It works fine if I attach addTextChangedListener to field1 only, but when I do it for both fields the app crashes. Obviously

Clone textview to append it to a ViewGroup

I have a ViewGroup defined in XML with a view inside, at onCreate time I’d like to have a variable of those. I don’t want to go through the hassle of using a listview+adapter cause its clearly overkill as I know the list won’t change since onCreate() This is more or less the code I’d like to have. But it

Switch between a TextView and EditText

Is this possible to interchange a TextView and an EditText. Like display the text when needed, but allow editing when needed. Is there a method (as in NON-XML) way of editing a TextView or non-editing a EditText? Answer Is this possible to interchange a TextView and an EditText. Put both in your layout in the same spot. Make one invisible.

Advertisement