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

  • Home
  • SEARCH
  • 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 1095853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:11:29+00:00 2026-05-17T00:11:29+00:00

i’m kinda new to programs which feature an mvc architecture and i want to

  • 0

i’m kinda new to programs which feature an mvc architecture and i want to get the right idea right up front…

i have this (android) application, where a thread (separate from the UI thread) computes some data. when finished, the results are written to a member of an object. now: how do i get the UI thread to “realize” that there has been an update (i.e., that the UI thread has to redo the screen output).

the most obvious way – to run an endless loop in the UI thread that checks in every loop if there has been an update – is pretty lame. so how do i do this “right”?

  • should i use a handler, that is called by the computation thread every time new data is available. this handler would then trigger a function that redraws the UI.

  • should i use wait() and notify() for the UI thread to be made aware of the fact that there is new data available?

i’m a bit lost here. although i know the basics of these concepts, i dont know which one is the “best” one to use here…

EDIT: to clarify:

i have a class A (which is an android Activity) and a class B which is instantiated by A. This class B has a member variable X and runs a thread, that computes the value of X. when the thread finishes, it sends a message (with the computed value) to a handler of B. this handler then sets the value of X.
now: since B stores no reference of A, how do i “notify” A that there has been a change of the value of X? do i send another message object which is “caught” by a handler in class A?

  • 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-17T00:11:30+00:00Added an answer on May 17, 2026 at 12:11 am

    Use a handler and let the background thread notify the UI thread if an update is available.

    Don’t block the UI-Thread with a loop or with wait. This will make your User Interface unresponsive and get your App killed.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
This could be a duplicate question, but I have no idea what search terms
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I

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.