tags:

views:

21

answers:

1

Hello people,

there is a protected method replaceText for autocompletetextview in Android.

I have no idea how to use it and need some examples.

Is it possible at all to use this method?!

Mur

A: 

I think it is only used internally.

The setText method will replace the text in the box so I can't see why you'd need it anyway.

FixerMark
I just had problems with setText and onTextChangedListener. Everytime I called setText, it fired listener as well.
Mur Votema
You might be able to dynamically adjust the contents of your autocomplete list somehow but setting a flag so that the listener knows it's not needed is probably easier.
FixerMark
Hmmmm ... can you give an example how to set a flag for listener or in activity?
Mur Votema
Start by creating a Boolean member variable for example mSettingText
FixerMark
Give it a default value of false. In your onTextChangedListener function include something like: if(mSettingText) {mSettingText=false;return;}Then, just before you call setText each time, set mSettingText to true. onTextChanged will still get called but won't actually do anything.
FixerMark
Nice idea, thank you for this advice
Mur Votema