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

How to get libphonenumber to format French phone numbers?

I am looking into the libphonenumber library (https://github.com/googlei18n/libphonenumber), but I am only able to get it to work for "US" and "BR" regions. How do I get it to work for "FR" region? The format I am seeking is 1 41 02 25 00. I was…
portfoliobuilder
  • 7,556
  • 14
  • 76
  • 136
0
votes
2 answers

TextWatcher EditText

I am having problem in putting a check on EditText. I need the user to enter values between 1-100 and if the value exceeds the toast should display and the EditText input should get refreshed. Please do help me with the ontextChanged part. The…
Waleed77
  • 3
  • 3
0
votes
2 answers

show TextView text depending on an answer

I am very new to this sort of thing and am trying to teach myself but have gotten stuck here. I am writing an app which will calculate the size battery required. The calculator side of things i have done and it is working however i want to add a…
Harni
  • 11
  • 4
0
votes
1 answer

Trying to format an EditText to be a double with two decimal places using TextWatcher

I am trying to automatically place a decimal two places in when the user begins to type in an EditText. The problem is I'm trying to set the TextWatcher on the EditText that I'm working with so when it updates the text in the field it recursively…
0
votes
4 answers

converting numbers to currency format when text changes

I am using RxTextView.textChanges for EditText that when the user is typing change value of EditText to convert numbers to currency format like below: 1,000 But I can't see any convert numbers to currency format. I am using from: …
user4813855
0
votes
2 answers

Calling String methods crashes the application inside TextWatcher

I am trying to retrieve which key was pressed inside an EditText view and set it as text of a TextView in the same activity. For example, if the last key pressed was the letter 't', then I want 't' to be displayed in the TextView (and not the entire…
user5818995
0
votes
0 answers

edit text, textWatcher called multiples

i have a custom editText, with TextWatcher. I have to formate user input after text changed. Every think works fine, but in case of space the method afterTextChanged was called multiples. FYI : I use android:inputType="textNoSuggestions" but still…
Ahmed.ess
  • 265
  • 3
  • 10
0
votes
2 answers

How Android EditText inputType attribute with value textMultiLine breaks the lines?

I have an EditText field with the attribute inputType set to textMultiLine, this breaks a text into several lines, so far so good. I attached a TextWatcher to the EditText so I can check for any change. In the method afterTextChanged I want to check…
0
votes
2 answers

How to add text watcher on inflated view

I m using LayoutInflater to inflate same view multiple times. i want to set TextWatcher to watch text change of a perticular view. when i use my code then its not working. please help. LayoutInflater inflater =…
Karan
  • 3
  • 5
0
votes
1 answer

android addTextChangedListener(TextWatcher) not working for the second time

I have 6 edit texts on my screen (used to enter 6 digits) If I enter 1 digit on one EditText field the focus should go onto the next one and so on. If I hit back space on some edit text field the focus should come to the previous edittext field…
0
votes
1 answer

EditText phone number format text watcher but with different country codes from a spinner on pre-Lollipop

I'm currently trying to implement this: I've already done the spinner part, though the phone EditText, I'm not so sure about how to make a TextWatcher for it. I have 2 options: I use: phoneNumberET.addTextChangedListener(new…
Ali Bdeir
  • 4,151
  • 10
  • 57
  • 117
0
votes
1 answer

How to make edittext in android always have 2 decimal digits regardless of the value entered by the user?

I want my edittext to always have 2 decimal places at the end regardless of the value entered by the user. How to accomplish this. Tried setting it with aftertextchanged method but it goes into an infinite loop.
0
votes
1 answer

Text Watcher to detect backspace and white space in android?

Is there option to detect EditText input is white space or backspace. I want to get to know if user enter something in between already typed words.
0
votes
0 answers

Performance Issue Query : Using Interface with textWatcher

I've a query regarding performance issue. I've 6 EditTexts in a fragment. On each EditText I've added a textWatcher. Inside every afterTextChanged() method I'm sending all the 6 values to the activity through interface. So, practically all 6 values…
0
votes
2 answers

EditText control in Android

I'm making a validation form with EditText. I have three EditText boxes and I want to make sure the user types something on ed1 before going to ed2. So, I want to block the user from going to ed2 unless they put something in ed1. If ed1 is null, the…
JuJu Juned
  • 134
  • 8