Questions tagged [android-textwatcher]

For questions related with TextWatcher callback interface

A special interface, that allows watching of the Editable field contents.

Has three callback methods:

  • void afterTextChanged (Editable s)
    This method is called to notify you that, somewhere within s, the text has been changed.
  • void beforeTextChanged (CharSequence s, int start, int count, int after)
    This method is called to notify you that, within s, the count characters beginning at start are about to be replaced by new text with length after. It is an error to attempt to make changes to s from this callback.
  • void onTextChanged (CharSequence s, int start, int before, int count)
    This method is called to notify you that, within s, the count characters beginning at start have just replaced old text that had length before. It is an error to attempt to make changes to s from this callback.

Useful links

205 questions
0
votes
1 answer

Android disable text watcher when there are letters

I need help on my code. I have an editText where the user enters the opening and closing time of the store and there is a checkbox with "Close". The user enters the opening time 09:00 and then with the Text Watcher I add a space and a dash and the…
Marie Hopkin
  • 61
  • 1
  • 7
0
votes
3 answers

How to handle Number Format Exception in edittext OntextChanged

I have edit text in my app to manipulate product quantity, but the issue if I will change the quantity , on that time getting NPE. to change the quantity in edit text I need to remove existing and need to add a new one, please check following…
chris
  • 699
  • 4
  • 12
  • 35
0
votes
0 answers

Implementing TextWatcher for EditText

in my simple application i'm trying to implementing TextWatcher for some EditText that i have in layout, i want to support getting default current edittext value which i set into that by code and support afterTextChanged, for implementing that i…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
0
votes
2 answers

Edittext textwatcher triggering for all editexts in a listview

I have a listview which contains an editext for each position. I have assigned a textwatcher for each edittext as below: holder.prodQuantity.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s,…
0
votes
1 answer

Text watcher auto complete only works for first character typed and then stops

So I'm using a text watcher to show the user suggestions for tags. Currently I am using a dummy list of tags. When the user starts typing, the code should create a another list of tags that is just the objects of the first list filtered based on…
Tsabary
  • 3,119
  • 2
  • 24
  • 66
0
votes
3 answers

Enable Button when Spinner and EditText are not empty in Dialog

In my AlertDialog, I have a Spinner and an EditText. I am trying to disable the positive button of the dialog if selected item at Spinner is "Select currency" ("Select currency" is the first item in my Array and Spinner is set to return String…
0
votes
1 answer

onTextChanged TextWatcher problem with Android 7.0

My phone was just updated from Android 6.0 to 7.0. After the update I notice a feature in my app is not working correctly, that is, the EditText will not accept the entered character and will instead repeat the previously entered character. The…
0
votes
1 answer

How to check whether given text is valid or not using TextWatcher?

I want to implement the MPIN functionality in my mobile banking application..I have six edittext using text-watcher I'm doing this function. Once i completed the 6 fields how to check whether that pin is correct or not automatically and how to show…
kalai
  • 51
  • 1
  • 2
  • 8
0
votes
0 answers

ExpandListview with edittext and textwatcher listener. Textwatcher fires multiple times

We are facing the problem with textwatcherlistener i.e,keypad multiple times. Edittext inputtype is number but screen showing with 2 keypada i.e, number & default one. we are using expandlistview( with in one more expandlustview dynamic data) has…
0
votes
0 answers

TextWatcher skipping characters during api call

Below code is part of search box in my android app. LoadCatalog is a async task for the api call, problem is whenever it is being called the editText stops taking new character for a fraction of second(skips a character in middle). for ex- if the…
ts178
  • 321
  • 1
  • 6
  • 20
0
votes
1 answer

TextWatcher methods called multiple times

I have one edit text in Adapter , I have attached addTextChangedListener to it and all methods of it called multiple times , My output is like , If i suppose put Home output comes like H Ho Hom Home
0
votes
1 answer

Using RadioButtons to change "mode" while being able to use TextWatcher

I'm developing a simple app that flips the word in a sentence. I need it to have three ways of doing that depending on mode the user chooses by enabling RadioButtons. So I use RadioGroup as parent layout to be able to enable one RadioButton at a…
esQmo_
  • 1,464
  • 3
  • 18
  • 43
0
votes
1 answer

Delete Character & Character length limit not working in MultiLine EditText Android

I am using multi line edit-text, I restrict character not exceed 42 in Text Watcher but I cant able to delete char in my edit-text it moves to new line.How to delete characters and add new line if character in line exceeds the limit? XML Code : …
appukrb
  • 1,507
  • 4
  • 24
  • 53
0
votes
1 answer

Capture Keyboard press event in the MainActivity from any Fragment in Android

Due to a security constraint in my app, the users are logged out if there is inactivity for >2mins. In my MainActivity I have Overided dispatchTouchEvent and it is called every time the user interacts with the app. But dispatchKeyEvent is not called…
0
votes
1 answer

TextWatcher monitor only current input

I have EditText which is connected with TextWatcher I'm monitoring when user presses @ letter. That will make a Listview appear with names of commentators on particular post. When user chooses one of the users from ListView, name is append to…
Yupi
  • 4,402
  • 3
  • 18
  • 37