Questions tagged [textwatcher]

TextWatcher is an interface in the Android SDK that can be attached to an Editable object to see when that Editable's text changes.

The android.text.TextWatcher Java interface is implemented by objects attached to an widget on . It exposes three methods, each of this methods will be called at a certain moment of the text being modified (for example: after the text is changed). Care must be taken when using the TextWatcher's methods to avoid getting into an infinite loop or to incorrectly modify the text.

625 questions
6
votes
5 answers

How to display "No Result" in filterable ListView?

I have a ListView and an EditText. I implement addTextChangedListener on EditText to filter the ListView content. leftList.setTextFilterEnabled(true); et_search.addTextChangedListener(filterTextWatcher); and then the TextWatcher is: private…
6
votes
3 answers

Need help getting an Android TextWatcher to work with incoming compound barcode data

I am writing an app that uses and externally connected USB barcode/RFID scanner. The data being scanned in, is "compound" data. Here is an example: =+03000=W12560712345600=%2800&>0090452359 That is from a compound data scan. The delimiter in the…
Brian
  • 1,726
  • 2
  • 24
  • 62
6
votes
1 answer

TextWatcher onTextChanged not working with soft keyboard auto-complete / suggested words

I'm Implementing a TextWatcher on an EditText to find and underline a series of keywords within the text whenever a new character is entered by the user. However when a suggested / auto-complete word on the soft keyboard is selected, instead of…
6
votes
3 answers

Android Password Strength checker with seekbar

How to Create Password Strength checker with seekbar in android ?
Parth Kathiriya
  • 137
  • 2
  • 4
  • 8
6
votes
3 answers

How to filter the input of EditText?

I want to filter the input of an EditText, only digits and letters are allowed, first I use TextWatcher to deal with the last input character, but when you move the cursor or you past some content to the EditText, this method failed, now I want to…
twlkyao
  • 14,302
  • 7
  • 27
  • 44
6
votes
6 answers

formatting expiry date in mm/yy format

Hi I am writing an edittext in which I want expiry date of the credit card in MM/YY format. The algorithm I want to implement is as follows: If user enters anything from 2 to 9. I change the text input to 02/ to 09/ If the user enters 1, then I…
user1051505
  • 952
  • 3
  • 22
  • 37
6
votes
4 answers

replace character inside TextWatcher in android

i use a TextWatcher to change pressed key value. my goal is that replace some characters while typing. for example when i type keys, if reached "S" character, replaces it with "a" character. my question is: should i do it in beforeTextChanged??…
Fcoder
  • 9,066
  • 17
  • 63
  • 100
6
votes
2 answers

How do I delete text in EditText with TextWatcher? Every time it detects a string and formats its

I have an EditText with a TextWatcher. It is supposed to format the text to a human height like 5'9". But when user makes a mistake and wants to delete the mistyped character the TextWather doesn't allow him to do that. Let's say user wants to…
Sean Kilb
  • 959
  • 5
  • 16
  • 27
6
votes
1 answer

Android use text watcher to prevent typing of special characters

I want to make an EditText box and use TextWatcher to prevent typing of special characters.
Sourav301
  • 1,259
  • 1
  • 14
  • 24
5
votes
2 answers

Count characters with TextWatcher fails on HTC longpress

I have 3 EditText elements, and I want to jump from one field to the next if there are 4 characters in the input. I use a TextWatcher for this: getEditView(R.id.edit_code1).addTextChangedListener(new TextWatcher() { @Override public void…
Jurriaanr
  • 53
  • 3
5
votes
4 answers

How to update the same EditText using TextWatcher?

In my Android application I need to implement a TextWatcher interface to implement onTextChanged. The problem I have is, I want to update the same EditText With some extra string. When I try to do this the program terminates. final EditText ET =…
JibW
  • 4,538
  • 17
  • 66
  • 101
5
votes
1 answer

Dynamic AutocompleteTextView with ArrayAdapter and TextWatcher

I'm trying to update the list of an AutocompleteTextView dynamically using and ArrayAdapter. In order to update this View I use a TextWatcher to monitor any changes that may occur in the AutocompleteTextView. The problem is that the list isn't…
5
votes
2 answers

Change the colour of text as the user types hash tags

I am working on an application where the user can post content to a feed. In my edit text (used for composing) the text colour is grey. However when the user types a hash tag e.g. #help I need to colour that text black as they type, so when the…
DJ-DOO
  • 4,545
  • 15
  • 58
  • 98
5
votes
1 answer

How to keep focus on Edittext after notifyDataSetChanged?

Everytime I call notifyDataSetChanged in beforeTextChanged the focus of the edittext goes back to the first edittext inside the ListView. Did you encounter this kind of error? If yes, can you please give me some advice on how to deal with…
letsgotim
  • 99
  • 1
  • 9
5
votes
0 answers

TextWatcher and InputFilter bug/non consistent behaviour?

The basic problem I noticed a strange behavior when I combine an InputFilter with a TextWatcher. What I basically want to do is to help the user type a MAC address. First of all I want to add a separator (":") every two character the user types. The…
Fhnx
  • 91
  • 7