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
-1
votes
6 answers

Android - App crashing because of TextWatcher

When I write a number in the editText it works fine but when I delete the number the app crashes. This is the code: final EditText et2 = (EditText) findViewById(R.id.editText2); final EditText et3 = (EditText) findViewById(R.id.editText3); …
Camo001
  • 49
  • 2
  • 11
-1
votes
1 answer

How to match regex in java

I want a pattern like this: GJ-16-RS-1234 and I have applied following patterns but they are not working. My regex patterns are: String str_tempPattern = "(^[A-Z]{2})\\-([0-9]{2})\\-([A-Z]{1,2})\\-([0-9]{1,4}$)"; String str_tempPattern =…
Ravi Yadav
  • 2,296
  • 3
  • 25
  • 32
-1
votes
1 answer

How to get changed range in TextWatcher.afterTextChanged()

In http://developer.android.com/reference/android/text/TextWatcher.html, it says: you can use setSpan(Object, int, int, int) in onTextChanged(CharSequence, int, int, int) to mark your place and then look up from here where the span ended up. But…
Yifan Hong
  • 41
  • 6
-1
votes
1 answer

Simple Edittext Math Android

new SO user here and I'm new to android as well. I need help doing a simple calculation between two edittext boxes - without a button, using a textwatcher, so that after the user is done using the edittext boxes it can add the two together and…
REAL O G
  • 693
  • 7
  • 23
-1
votes
1 answer

how to show two text view record with edit text record of first custom list view to in second Custom list view on Edit text afterTextChanged

I have created two custom list view,first custom list view has two text view and one edit text ,and in second custom list view there is three text view,what i want to do is that when user enter the value in first edit text,the value of that edit…
Ravi
  • 95
  • 1
  • 2
  • 9
-1
votes
1 answer

Android EditText Money Input Style Without Dollar Symbol

I want to money input box without dollar symbol. There is a code which works fine with dollars private int price = 0; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { …
John Error
  • 2,076
  • 5
  • 18
  • 23
-1
votes
3 answers

get edittext characters and display into textviews

Using perhaps textwatcher is there a way i can type a word say blue into my edittext and have each character split and set text on multiple textviews textview1 displays b textview2 displays l textview3 displays u textview4 displays e thanks to all…
-1
votes
1 answer

Android - End TextWatcher when user enters '.'

I have a TextWatcher set up and working (nearly) exactly as I want it. However, I would like this TextWatcher to stop as soon as the user enters a '.'. The only solution I have found so far crashes the app if the user entirely deletes the text. …
Nic Steyn
  • 85
  • 1
  • 6
-1
votes
2 answers

on listview filtration is not working properly

I am facing problem while filtration of list .I am using onTextChange() method for it .It is working properly but problem is that as i type single character in edit Text the soft keyboard gets disappear and I have to tap edit text again to type…
Sneha Bansal
  • 941
  • 1
  • 13
  • 38
-1
votes
3 answers

Making EditText accept only alphas as first character

In my EditText I want to enter the first character as alpha and the remaining is whatever. I achieved this task with the help of TextWatcher. But now my problem is if I entered something wrong(like digits, special characters) as my First character…
Gunaseelan
  • 14,415
  • 11
  • 80
  • 128
-1
votes
4 answers

TextWatcher not serving its purpose

The following code snippet is used for a text Watcher...it doesnt work...everything works fine,untill the last line of code... private TextWatcher mobileTextWatcher = new TextWatcher() { @Override public void onTextChanged(CharSequence s,…
Sreekanth Karumanaghat
  • 3,383
  • 6
  • 44
  • 72
-2
votes
2 answers

checking if the text contains a character and if it is the same as other text Android studio kotlin

I want when I click @button to check if there is an '@' sign in EditText @email and if EditText @password and @password2 have identical text. I know that I can use the TextWatcher to check if a given character exists, but I don't know how it works.
Wex
  • 1
  • 1
-2
votes
1 answer

android date of birth calculator in months and year using textwatcher. input is from user

I am writing a age calculator feature where user enters the value for its age in years(birth year) and in months(birth of month) and based on the entered values it calculates the age. There are two edittext one for (age in year) and other for (age…
Aniket
  • 982
  • 1
  • 11
  • 16
-2
votes
1 answer

Refresh TextView while typing a EditText

I'm building a a checkout activity, the user Input the values (Number) inside one or more EditText. In the bottom of the activity I need to update the total value with the sum of all EditText. I've tried to use the TextWatcher like this: …
Leonardo Cavazzani
  • 293
  • 1
  • 2
  • 13
-2
votes
1 answer

Null pointer exception with values on text change listener android

I have code to simply calculate compound interest. The calculation will change when the user edits the value in an EditText view. public class CompoundInterest extends AppCompatActivity { TextView mCompBalance; TextView mBalance; …
1 2 3
41
42