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
2 answers

Android reverse money input with fixed decimal

I want to create an Eddittext to type in currency values with 2 decimals from left to right. If there´s no value it shows 0.00, and as the user types the text should change acording to these rules: I´ve tried getting it done using TextWatcher like…
-1
votes
3 answers

How can I prevent an EditText from accepting a character 4 times consecutively in Kotlin for Android?

How to make edittext not to accept same character 4 times consuctivelty. For example it can accept "888" and not "8888". And if user writes a same character 4 times then the edittext should stop taking input I am not sure how to implement this with…
-1
votes
1 answer

android TextWatcher beforeTextChanged problem

in my application i have many edit text and i implemented textWatcher for them i want them to increase and decrease a textView number but i can only increase it i tried to check if the old text is bigger that new text and decrease the textview…
Melfun
  • 353
  • 1
  • 3
  • 14
-1
votes
1 answer

EditText.addTextChangedListener(android.text.TextWatcher)' on a null object reference Textwatcher

I created a Custom ListView and am trying to create a Custom Filter / Search Filter via EditText. edit_search or edit_text are in appBarMain (standard layout android studio). help me implement this in code, and make the transfer of…
-1
votes
1 answer

Recyclerview editText display list item position with item as " item 1" not "item 0"

Hi there I have this adapterclass which display editText in recyclerview it works fine, but what I want to do is to change list item position displayed by edit text, since am using an array it display the first item as "0", so how can I make it…
-1
votes
1 answer

My app Stopped Working When I Added TextChangedListener

I'm trying a simple Android application which has a EditText field. The App worked just fine until I added a TextChangedListener to the EditText. The app keeps stopping, and when I remove the Listener, it just works like nothing happened. Any ideas…
-1
votes
1 answer

Application Crashed when trying to input on an edittext that has an TextChangedListener

I was trying to create an application that automatically calculate the percentage. the Percentage value will be shown in a TextView. The value that will be shown in the textview will be based on the inputted value of the user in an edittext. I've…
Tonyo
  • 1
  • 1
-1
votes
1 answer

Dynamic Word Count for EditText

I am trying to get the Dynamic Or Live word count for an Edit Text. To explain the problem, I have an EditText and a Textview inside a fragment, whenever the user enters a sentence in the EditText it should automatically count the number of words…
-1
votes
1 answer

edittext addtextchange listener reapeting text

i've seen so many example but no one work for me. what i want is to set text to the TextView through the EditText's addTextChangeListener(). but my textview text is repeating for each character i typed in edittext. here i my…
Sagar Chavada
  • 5,169
  • 7
  • 40
  • 67
-1
votes
1 answer

Accessing TextWatcher in another class - nullpointer exception

I have one activity and one of its function logic is calculated in another class, here i calculate when something is entered in the edit text field, i use a text watcher. MainActivity code: public class UnitConverter extends AppCompatActivity { …
Mann
  • 576
  • 1
  • 9
  • 33
-1
votes
2 answers

how to set one textwatcher for dynamic more than Edittext in android

I Want to set one textwatcher for dynamic more than Edittext .if I am Creating Dynamic Edittext I want to use One textWatcher for all Dynamic Edittext.if anybody know tell me
Selva Meena
  • 43
  • 10
-1
votes
1 answer

Add custom adapter, custom autocompletetextview and database to custom textwatcher

I'm learning Autocompetetextview to get suggestions from web service. For this I used this tutorial. The only problem in their code is They have linked their custom adapter, custom autocompletetextview and local database in the custom textwatcher…
Sammy
  • 181
  • 3
  • 18
-1
votes
2 answers

How can I optimize my syntax highlighting?

I am making a text editor in Android and I want to add syntax highlighting to it. With my current implementation, the UI is laggy when I type something. I need help with optimizing my current implementation. private void onEditorListener() { …
-1
votes
2 answers

getting edittext.settext data from textwatcher in android

I am setting the text in EditText but when getting the text from TextWatcher it is giving empty string. Please check this code for (int i = 0; i < 4; i++) { et = new EditText(this); et.setText("hai"); final EditText finalEt = et; …
-2
votes
1 answer

Prevent user to add text after 10 commas entered in edittext

I have to create a comma-separated array. So after 10 comma edittext should not accept the text or latter enter by user <- I have to do this. Here's the code I am using. but it goes to infinite loop after if condition in…
Himani
  • 440
  • 1
  • 6
  • 17
1 2 3
13
14