Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6743117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:55:24+00:00 2026-05-26T11:55:24+00:00

Imagine I have 5 EditText and I need to to populate values when one

  • 0

Imagine I have 5 EditText and I need to to populate values when one edittext value is changed. The values are interdependent. I am using the following logic to achieve that.

//Finding which edit text is originating values 

for(int i=0;i<mEditTextIds.length;i++){ 
        txt[i]=(EditText) findViewById(mEditTextIds[i]);
        txt[i].setOnTouchListener(new EditTextTouchLisner());
        txt[i].setId(i);
}


//Enable that Edittext's TextChangeListner and disabling all other Edittext's TextChangeListner ..

if (event.getAction() == MotionEvent.ACTION_DOWN){
    for(int i=0;i<mTableRowIds.length;i++){
        if(i!=v.getId()){
            txt[i].addTextChangedListener(null);
        }       
    }
    txt[v.getId()].addTextChangedListener(new TextChangedListner());


//calculating values 

@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
    //calculate();
    Toast.makeText(getApplicationContext(), "CHANGED", Toast.LENGTH_SHORT) .show(); 
}

But if I click edittext a second time I get the following errors:

10-25 16:23:05.149: ERROR/AndroidRuntime(2378): FATAL EXCEPTION: main
10-25 16:23:05.149: ERROR/AndroidRuntime(2378): java.lang.NullPointerException
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.widget.TextView.sendBeforeTextChanged(TextView.java:6116)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.widget.TextView.access$700(TextView.java:187)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.widget.TextView$ChangeWatcher.beforeTextChanged(TextView.java:6309)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.text.SpannableStringBuilder.sendTextWillChange(SpannableStringBuilder.java:878)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:279)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:269)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:432)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:409)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:28)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:583)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:384)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:292)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:73)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.os.Looper.loop(Looper.java:123)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at android.app.ActivityThread.main(ActivityThread.java:4627)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at java.lang.reflect.Method.invokeNative(Native Method)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at java.lang.reflect.Method.invoke(Method.java:521)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-25 16:23:05.149: ERROR/AndroidRuntime(2378):     at dalvik.system.NativeStart.main(Native Method)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:55:24+00:00Added an answer on May 26, 2026 at 11:55 am

    To remove Textchangelistener

    txt[i].removeTextChangedListener(watcher);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine I have the following: inFile = /adda/adas/sdas/hello.txt # that instruction give me hello.txt
Imagine you have one page app using Javascript MVC, which should switch between sub-apps
imagine you have a function that creates/copies/moves files. [logic] For the case that a
Imagine I have an function which goes through one million/billion strings and checks smth
Imagine I have these python lists: keys = ['name', 'age'] values = ['Monty', 42,
Imagine I have a process that starts several child processes. The parent needs to
Imagine you have a website with several drop-downs that are populated from the back-end
Imagine I have the following situation: Test1.java import java.lang.ref.WeakReference; public class Test1 { public
Imagine I have a stack-based toy language that comes with the operations Push, Pop,
Imagine you have a secured site and a View that can be generated in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.