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

Developing an app with 100's of EditFields and TextFields

I am developing an app with 100's of textfields and editfields. In a lot of them I have used textwatcher to listen to changes and update other textfields. I dont have much choice on this matter as a lot of fields are dependent on each other. But the…
ACE
  • 1
  • 1
0
votes
2 answers

Android:Disable Button on app launch enable only when Edit text is filled

I want to Android:Disable Button on app launch enable only when Edit text is filled. help needed. thanks in advance. I am Android Beginner. Tried using TextWatcher. app is running fine when i don't add this feature. please suggest how i can…
0
votes
0 answers

TextWatcher in Android not setting values in other edittexts

I have three edittext values for which i am using textwatcher to update data. I want that if i enter any value in anyone of the edit text then according to that value it should calculate and then update the edittext in which i entered the value…
0
votes
1 answer

how to enable button if 2 edit text is fill?

how to enable button if 2 edit text is fill use 'androidx.core:core-ktx:1.1.0'? override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) editTextEmailOrPhone.doOnTextChanged {…
Afdal
  • 501
  • 9
  • 19
0
votes
1 answer

Manipulate or capture EditText input efficiently

What i'm trying to achieve I want to convert every char the user inputs to another char and display it in the EditText. What i've done My first approach is implemented using a TextWatcher. private val textWatcher2 = object : TextWatcher { …
Yannick
  • 4,833
  • 8
  • 38
  • 63
0
votes
0 answers

Text Watcher, Erase Moves text to the left

In my App I have a few edit texts for dates I then Have a text watcher to force the format of DD/MM/YYYY I also have a a few lines of code to automatically enter the current date Auto Date code SimpleDateFormat dateF = new SimpleDateFormat(…
0
votes
0 answers

Trigger Multiple Times TextEdit onTextChanged

My basic code is works, but then i confuse about trigger, when edit some editText. When editText is edit or change.. my reference's : TextWatcher events are being fired multiple times My input type Xml is number, and i try it. other method is use…
Budi Mulyo
  • 384
  • 5
  • 22
0
votes
0 answers

Filter list filter results have no values while there are items in array list

I'm trying to make a filter for a custom listview, the result of filter keeps showing all the items in the arraylist. After checking with the log, I found there are itmes in the filteredList but the results.count returns 0, this is the Log when I…
YETZ W
  • 1
0
votes
1 answer

how to use TextWatcher with query in android?

I have made an EditText where I type inside it some name. I had like the app to perform search every time something changed in my EditText. I used the following code: txt_search.addTextChangedListener( new TextWatcher() { @Override public…
Ben
  • 1,737
  • 2
  • 30
  • 61
0
votes
1 answer

Combine both on text change and debounce in rxjava for edittext

I've been using rxjava2 for a while but mostly kind of a boilerplate, I didn't clearly know its features. I supposed to create a search Edittext which call method after sometime. I got it working by the following…
Tran Hoai Nam
  • 1,273
  • 2
  • 18
  • 35
0
votes
1 answer

Bug With TextInputLayout on Configuration Change

I'm using TextInputLayout in my application and when I add a TextWatcher to it's TextInputEditText that sets an error on the TextInputLayout, my app crashes when I trigger a configuration change. editText.addTextChangedListener(object : TextWatcher…
tylerbwong
  • 15
  • 6
0
votes
0 answers

How can I keep data in an EditText from updating?

I am currently working on an application which read some database, display it on my application (text and image) and I want it to be able to send email containing a certain quantity of items provided by my database. For the moment, the layout is…
Nicok3
  • 1
  • 1
0
votes
1 answer

How to add 3 decimal places Currency formatting to edittext Using TextWatcher Android

I want to add 3 decimal places currency formatting to EditText using TextWatcher at the beginning, value is 0.000 and the number should change right to left eg: if I pressed 1,2,3,4,5 in order value should appear as this 12.345 following code is…
0
votes
0 answers

How to autofill edittexts by getting SQLite data?

In my App, I have a form. In which user puts CNIC first. If his CNIC exists already in SQLite database. User's name and mobile number will automatically be filled in the edittexts (using TextWatcher). But whenever I type a same CNIC, app crashes. If…
user8680980
0
votes
1 answer

Couldn't read row 0, col 2 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it

In my App, I have a form. In which user puts CNIC first. If his CNIC exists already in SQLite database. User's name and mobile number will automatically be filled in the edittexts (using TextWatcher). But whenever I type a same CNIC, app crashes. If…
user8680980