Editing screen, but still wait for thread to return

I have an app that makes updates to the user interface through a reference to a bitmapfield a new thread, and that thread is updating the user interface.

The problem I have is that I want the main thread "wait" wire under update charts, before continuing with the "game".

so... for example...

// update the main bitmapfield  pt = new PlayerThread(bfField,square);
pt.start(); 

// wait for the thread to finish updating the ui while (pt.isAlive()){}

Now, I * KNOW * it is not the right way to do this, because the UI is not updated, because the user interface is in a loop waiting for the thread ends, which defeats the purpose of having the thread in the background in the first place.

What is the 'proper' waiting to do this? I completely missed the point to put on?

It works fine if I do not "wait" for the thread, but this means that the user can press the buttons, or interact with the game when they aren't supposed to.

I thought that there must be a way to define a 'isthreading = true' var and disable keys by adding an if statement to my keydown, but how can I make my app "waiting" for the thread, I created to be finished, but not really break the UI itself?

I hope that was clear...

You need a reporting mechanism indicating the UI thread "I'm done" or "the data is ready. Never loop in a UI thread - this will cause finally the event queue to overflow, which ask you dumped as "refractory".

A typical mechanism is to implement a listener and a data event. The "interested" party registers a listener with the background thread, the background thread fires the event data when appropriate.

If there is only a single listener, then it can be implemented with fewer resources by using a callback mechanism.

Search for references to the model of the observer:

http://en.Wikipedia.org/wiki/Observer_pattern

Tags: BlackBerry Developers

Similar Questions

  • still waiting for out of warranty repair to fix my pc.

    Hello I have an alien ware m18x and spent a lot of money on this laptop. I liked from the start, but not even a year after the motherboard came out no problem my warranty covered. Welcome to 5-6 months later my warranty has expired and bam the motherboard went out to new same problem than before. It happened in mid-term for the College so I called the guy and a week later was able to pay and send my laptop.

    now, this is where I am getting very angry with dell. When I sent that far they told me 7-10 working days although we are on day 20 now and nothing has been done with this laptop. Let's start in the order of all the stuff that has happened since you guys my laptop.

    1. I sent the laptop to you guys, but it took 2 days for the depo to sign for it.

    2. the depo began working on it and then 5 seconds later put a shim of payment by saying that I did not pay $430. It took about 3-4 days of calling me support and begging them to tell the depo I paid and even provide my payment number.

    3. have you called agents support so many times to ask what is the hold up because the depo never updates the link, they sent me in email. officers tell me to wait and just check the link.

    4 depo puts a wedge of parts which took more than 2 weeks to find just that part. I'm always told that they do not always have a part.  Nobody sews really to find out what is happening right now.

    honestly, I regret spending crazy amount of money I did on this mobile no only I'm still waiting for some news as to when its going to be fixed, but this delay destroyed my college this semester. I have finals in 2 weeks, I also have my review of certification compIT in 3 weeks all the stuff that I need are in the computer including all my papers. I am begging you guys just get my laptop fixed or ask someone who speaks English actually could you tell me what is happening.

    honestly, I want to start looking for a monetary value for the amount of hassle, than what has been. «There was a lot more, but as I am not the kind of person that insults people I haven't posted it.» but lets just say that some calls where not very beautiful side valleys.

    Hello Travis,

    First of all, I would like to apologize for any discomfort your siding with your system and the time it has taken to repair the unit.

    From time to time, Dell may run into questions parties may run out of stock and there is not a viable substitute available role. That puts us in a position of having to order the parts from our suppliers and await his arrival. Without knowing the details of your case is probably that your run in. You won't see any changes on the filing status tool until the device is taken out of the hold of the party or other actions take place.

    I am working actually came out of the repair center, and I can check some internal tools to see if I might be able to get a better eta on when the requested party should. If you want to consult me send me a request for direct message with the Service Tag, shipment number and the name of the system is saved. Don't post personal information on the public domain.

    It is recommended, especially when you could be without your systems for a few days, it is best to have a backup of your data separate from your system.

    Kind regards

  • Media, recovery waiting for thread 1 sequence (in transit)

    I have rebuilt our standby database using rman double since it lacked many newspapers of archiving.

    After the double, the eve is now almost in sync with the primary. The Marbles that ship through, but are not implemented in a timely. How long should wait to a journal of the Archives of the primary to be applied to the waiting?

    I need to know this so that a good script can be configured to check the primary and standby. For the moment, that they are never exactly synchronized - sequence always one behind the primary number.

    Why is Eve does not have in a timely fashion?

    From the journal of alerts:

    Media, recovery waiting for thread 1 sequence 11278 (in transit)

    The journal seems to be "in transit" for a long time

    PRIMARY:
    SQL > select max (sequence #) the journal of v current_seq $;

    CURRENT_SEQ
    -----------
    11278


    SB:
    SQL > select MAX (SEQUENCE #), APPLIED from V$ ARCHIVED_LOG in case of APPLICATION = 'YES' GROUP APPLIED;

    MAX(SEQUENCE#) APP
    -------------- ---
    YES 11277


    JOURNAL ALERTS:
    RFS [2]: Archived Log: ' / backup/prod/log_1_11277_704816194.dbf'
    Primary database is in MAXIMUM PERFORMANCE mode
    Mon Nov 1 15:22:01 2010
    Recovery Media Log /backup/prod/log_1_11272_704816194.dbf
    Mon 1 Nov 15:26:49 2010
    Recovery Media Log /backup/prod/log_1_11273_704816194.dbf
    Mon Nov 1 15:29:54 2010
    Recovery Media Log /backup/prod/log_1_11274_704816194.dbf
    Mon Nov 1 15:34:18 2010
    Recovery Media Log /backup/prod/log_1_11275_704816194.dbf
    Mon Nov 1 15:36:42 2010
    Recovery Media Log /backup/prod/log_1_11276_704816194.dbf
    Mon Nov 1 15:39:43 2010
    Recovery Media Log /backup/prod/log_1_11277_704816194.dbf
    Mon Nov 1 15:42:34 2010
    Media, recovery waiting for thread 1 sequence 11278 (in transit)

    I should add that I understand that for the primary and standby to be interrupted by a newspaper is not a concern (they ask). It's just that I wanted a check that compare the two script and at the time where they are never equal - when I understand them to be, and that newspapers should apply almost immediately.

    Published by: Dan on November 1, 2010 16:36

    How long should wait to a journal of the Archives of the primary to be applied to the waiting?

    also depends on the speed of the network.
    Make sure that the archives are shipped instead of sleep.

    PRIMARY:
    SQL > select max (sequence #) the journal of v current_seq $;
    CURRENT_SEQ

    11278 (it's not connect archivelog)... :)

    SB:
    SQL > select MAX (SEQUENCE #), APPLIED from V$ ARCHIVED_LOG in case of APPLICATION = 'YES' GROUP APPLIED;
    MAX(SEQUENCE#) APP

    YES 11277

    Hi check MRP starts or not?
    database principal that you must not check the current sequence, generated check last sequence... not common sequence.

    current sequence is redo log, which has not yet been archived

    I think that everything is perfect here... no problems.

    Hope you understand, I would like to know if it is not explicit, thank you.

  • I bought the subscription Amazon to adobe cc says, but is waiting for activation by the seller

    I bought the subscription Adobe cc says, but is waiting for activation by the seller

    Hello

    Your account is created in Panama as a country, please create a new account, and select U.S. as the country.

    Following the steps described here change the country associated with your Adobe ID which should solve the problem.

    ^ Ani

  • What happens when "Still waiting for network when starting the computer and logon" is enabled and that the computer is not connected to the network?

    In MMC, I created the group policy and found through web search that computers with mapped network drives can connect better if "always wait for network when starting the computer and logon" is enabled...  So far, it has been very nice to have allowed.  Is no longer mapped network drives see the place as disconnected.  But what happens if the computer is not connected to a network?  Say the wireless router will turn off and your computer always 'wait... '. "turned on, should the user could still log the computer timely?

    Check these:
    Troubleshooting intermittent slow connection or slow start of http://blogs.technet.com/b/instan/archive/2008/04/17/troubleshooting-the-intermittent-slow-logon-or-slow-startup.aspx
    Priority and group policy processing
    http://TechNet.Microsoft.com/en-us/library/cc785665%28WS.10%29.aspx
  • Still waiting for a response to my response of the extra info about "unable to access xbox live because of parental e-mail account misspelled".

    Because the e-mail account was misspelled, we try to get the reset password sent to the email address is not possible, the address it is not mine. I need to reset the e-mail address of origin to the correct spelling, but, so far have not received a response from (ANN N) after that I have repied to his request for more info on 17 Oct. Please don't leave me hanging, bad customer service.

    Hello

    Thanks for posting in the Microsoft Community Forum, please be assured that we would do our best to help you with this problem.

    You may need to wait for the response of the person concerned or if there is a problem with the Xbox Live account, check out the following link:

    http://support.Xbox.com/en-us/billing-and-subscriptions/account-management/change-Xbox-Live-account-info

    or

    http://www.Xbox.com/en-us/forums

    If the problem is with windows live account you can report the query in the following forum:

    http://answers.Microsoft.com/en-us/windowslive

    Hope this information helps. If you have any questions do not hesitate to answer, we would be happy to help.

  • Windows 7 Edition Home Premium or wait for Windows 8

    Hello

    My six year, Sony's all-in-one PC is running slower and slower despite the developed and needs to be replaced this year. My dilemma is whether to replace now, probably with a laptop with screen 17.3 inch under Windows 7 Home Premium or wait for Windows 8 released. To use PC home and I'm a relatively unsohisticated user. Any advice much appreciated.

    Before getting a new laptop or PC, check their website to see if they already Win8 pilots. If so and you want something that looks like XP, I'd go for scope Win7 in time Win8 once it is released. A lot of the manufacturer may offer a "anytime upgrade" of Win7 for Win8 with the purchase of their product. Dell and others who did when Win7 is out; you buy a PC with XP installed, and you could get the upgrade later for a reduced price (and in some cases, free).

    I tried Win8 consumer Preview and really don't care for her. I'm not an iPad or iPhone user (I use my cell phone as a phone, not a computer), so I'm not all that familiar with the concept of full tile to do things. Give me a Start Menu and I'm happy :-)

    Of course, these are just my opinions, and I don't know there are many others who will be either agree or disagree with me, and that's ok. Diversity is what keeps life interesting :-)

    SC Tom

  • Anyone else STILL waiting for a replacement unit?

    Back in the middle of July, the headphone jack on my 8 GB Clip + stopped working in one ear, so I returned it to SanDisk returns Department in Czech Republic. They received it then told me that it would be exactly one month before they would send me a replacement. Of course, a month later they came back to me, but asked if I prefer a 4 GB one and a 4 GB sd card as they had lack of 8 GB those... what?
    I said that I would wait rather that I use my sd slot and I would 4 GB down. Weeks after this, still waiting. I tried to request a credit from Amazon as they have many units of 8 GB, unfortunately no response on this front.

    Anyone else waiting?


  • Still waiting for my seller account confirmation

    I am a new developer or actually, I just asked for the seller's account but have not heard of someone after I sent my documents. How long should I wait for a response?

    Just had accepted. I am so happy... I think that patience is the key

  • Still waiting for the new Satellite U840T-102

    We sent the laptop in the subject to support Toshiba in Italy on 5 May. File n. 73040100. After a few emails June 20, we received the proposal to change the product and sending us a new.

    We have NOTHING yet. Our clientele is more waiting for two months for a WARRANTY SERVICE.

    Is this right? It is the policy of TOSHIBA?
    CAN WE HAVE A CERTAIN DATE?

    I understand you very well buddy.
    It s always pity if the laptop is not working properly and if something needs to be replaced.

    I think there is a reason for the delay and I recommend you contact the ASP in Italy once more in order to clarify this matter.

  • When I stopped my PC, I get a black screen with message (waiting for substantive programmes close).

    When I stopped my pc I get a black screen with message (waighting for background programs close) then under this 'force close' yes/no of suggestions?

    Original title: background programs

    Depends, if shortly after the sys stops, don't worry, otherwise follow the advice given

  • My creative photography program cloud is not updated from CC programs, but is still waiting for them.

    I don't want to install Acrobat DC at all, as I already have X Pro. DC moved, and my Acrobat Pro X program stops working. I don't seem to get rid of.  In windows, is that the same problem was with Mac. My Pro X license number is no longer eligible. And the DC test program ended at work. I don't want to buy it.

    Hi outip93593829,

    You can uninstall trial Acrobat pro DC of your system via the control panel in windows & from applications, run the uninstaller for Acrobat pro DC.

    Then you can work on your systems with Acrobat X pro. Please provide the exact error message you receive to activate Acrobat X pro.

    Kind regards

    Christian

  • Black screen, but still works Satellite P200-01:00 - backlight is dead?

    Hello everyone.
    IM on the computer of my aunt and uncle and he has a problem: the screen is dark, but not dead. I mean, I still see things, but very slightly.
    But, on an external display, everything is ok.
    I searched on several forums and it seems that is what I thought: retro light appears to be dead.
    Do you know if it could be something other than the backlight dying?

    And do you know if it is easy to repair myself, if its possible to buy the piece, or I have to go to a store?
    The computer is a toshiba P200-01:00, 5 years ago so not under warranty more.

    Thank you very much

    Gilles

    I'm pretty sure FL inverter is faulty.
    > Do you know if it is easy to repair myself...
    It is not easy to do without maintenance manuals and experience in laptop disassembly. You know very well that one false move can damage the brackets made of plastic and you will have the problem.

    In my opinion try to contact Toshiba service initially. Ask how much you should pay for repairs.

  • Still waiting for the confirmation e-mail to arrive for the Windows 7 upgrade download

    I just bought a download to update Windows 7 Starter in the home edition, so I might want DVD on my Dell netbook.  The Microsoft app site said I would receive an email with the key code to download this.  I've been waiting over 2 hours now and still have not received the news.  Is this normal? Thanks for your advice.  Annette

    Have you checked your spam folder?

    Try to contact the Microsoft Store:

    1-877-MY-MSSTORE (1-877-696-7786)
    http://store.Microsoft.com/help/contact-us

    Releasing it's easy: with Windows | ActiveWin | Laptops | Microsoft MVP

  • Goes black screen, but still running

    This problem has been going on for quite awhile now. Randomly the my screen goes black, usually while I'm playing games or using the browser. It was just when I was with any browser, but its developed on when I play some games. It ruined some progress on the papers that I wrote (several hours lost can be pretty boring), so I decided to put here all the info to see if I could get any help on the situation. The computer still works fine, while the screen is black, I can even keep Skype calls and hear people talking all by not seeing a thing. The only way to get the screen to come back is to force him to stop. I also connected to an external monitor to test if it's a hardware problem or a system in question. The two crash screens indicating that its all just a system error.

    My specs:

    Accuracy of Dell M6500

    Windows 7, upgrade to windows 10 upon arrival on both versions

    NVIDIA Quadro FX 2800 M, up to the date of

    Intel Core i5 CPU M 540 @ 2.53 GHz

    8 GB Ram

    64 bit

    Hello

    I too had this problem the Dell Precision M6500 and Nvidia Quadro FX 2800 M with drivers on the Nvidia site. It has affected my machine before and after the upgrade to Windows 7 to Windows 10. I noticed that he has never done it on the battery. When on feeding, the graphics card seems to close as he thinks it's overheating, but it is not.

    The solution is to download the Nvidia PowerMizer software.informer.com Manager software

    Check enable the PowerMizer

    Check the level of interpretation or fixed performance select average for battery and network.

    Check the overheating slow by substitution. Select Disable overheat the downturn.

    That's all. : o).

    The only thing is every time 10 Windows updates (like this morning) the PowerMizer settings are rooted out the registry. This morning my machine was blacking out as soon as I open any program, and I had to pull the power cord to operate if I could start PowerMizer. I left a shortcut for the program on my desk top of the page.

    There is a separate issue with the Precision M6500 really one overheating due to dust in the hand and heat sinks graphic chip. See here for my healing:

    seakayakphoto.blogspot.co.UK/2014/01/Dell-precision-M6500-workstation.html

    I hope this works for others.

    Douglas: o).

Maybe you are looking for