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 6253161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:56:20+00:00 2026-05-24T13:56:20+00:00

The problem Similar to the question regarding Swing ( The Elegant way to handle

  • 0

The problem

Similar to the question regarding Swing ( The Elegant way to handle Cyclic Event in Java? ) I’m looking for a elegant way to avoid a cyclic event chain where two widget views depend on each other.

More specifically I have two EditText's, one of them represents a weight in kg, the other the weight in lb. The user should be able to enter text in either and have the other updated as he/she types.

What I’ve tried

The only way to act on a change in the controller that I’ve found is to register a TextWatcher on each EditText view. But how do I elegantly avoid the circular event chain that occurs if I modify the other EditText in the callback.

I tried sub-classing EditText and bind them together without using TextWatcher by overloading setText and have that method modify the value and call setText of the other controller. But that doesn’t work not calling setText, which seems to be the case when user enters text from UI and not programmatically.

Any ideas would be helpful, thanks.

  • 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-24T13:56:20+00:00Added an answer on May 24, 2026 at 1:56 pm

    I ended up adding and removing TextWatcher's when the controller is focused and unfocused. This has the drawback that the same mirroring code is not used when setting a controller’s text programmatically (unless I programmatically set the focus as well, which is not a very nice solution, IMO).

    It works fine, but I still think there’s a cleaner solution out there.

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

Sidebar

Related Questions

I found a Question similar to my problem( Regular Expression For URL Query )
Similar to this question: link However I have already mastered that. My problem is
I have a problem similar to the egg and the chicken. I have two
I've been looking for some considerable time for an answer to my question regarding
I have encountered a similar problem to others on SO regarding the orientation of
I am posting this question after reading other similar questions about my problem but
This question is somewhat similar to this one Best way to deploy large *.war
Some months ago there was a nice question regarding a 1:n matching problem and
I read similar questions to this problem but I couldn't find out why it
Similar questions here didn't helped me with my problem, so I'll just ask by

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.