Update the UI in the loop?

int currentValue = 0;int maxValue = 100;

GaugeField progress = new GaugeField("", 0, maxValue, 0, GaugeField.FIELD_LEFT);add(progress);

while (currentValue < maxValue) {      // do something cpu intensive    currentValue++;    progress.setValue(progress.getValue() + 1);

    // what do I do here to force my display to update?  Currently my device is frozen until my loop finishes} 

I googled and tried without success to what I assume is a simple answer.  The code example above is not my real code, it's just something I typed quickly to my question.  Help out me

OK I understand how to make it work.  Here's what I did for someone else who can be the solution.  I got my update of the gauge in the following block of code.  Can I really change so it updates only every 10 iterations or so since the repaints slow down things a bit.

synchronized (UiApplication.getEventLock())
{
    _KMLProgress.setValue(_KMLProgress.getValue() + 1);
    UiApplication.getUiApplication().repaint();
}

Tags: BlackBerry Developers

Similar Questions

  • Satellite C660 - 115 Win7 update stuck in the loop. SOLVED!

    I have a Satellite C660-115 which is stuck in a loop "of despair".
    I am a COMPUTER engineer support and a customer brought this laptop of mine, who was stuck in a loop of repair Win7 (64-bit prem) that simply says Win7 could not be repaired.

    I backed up the profiles of subscribers using Hiren boot CD (done chkdsk as well - everything is OK), and then did a factory restore.
    No problem at all with the restoration.

    Started doing the updates for Win7; SP1 seems to install OK without errors.
    The system then picked up 37 Win7 updates automatically and asked to reset.
    Upon reboot, Win7 entered "drvload.exe" and started an auto repair.
    It took time and the system started OK, but without any sign of SP1, looks so much like system restore to an earlier point?

    I though this update to process 3 times now and each time after that a lot of auto update, the same sequence occurs.

    How to exit this loop? What is causing this problem, which I have never seen before?

    No software has been installed, other than that of the recovery process.
    I even uninstalled McAfee, just in case this could be a problem - no change.

    Ah, just took another look. It is stated in Win7 system registers that the restoration was caused by a corrupted file C:\ci.dll. Google to find it was a sign by a rootkit virus in the HARD Master Boot Record disk (the file ci.dll itself is NOT damaged). Found a fix tool

    http://support.Kaspersky.com/viruses/solutions?QID=208280684

    It identified the rootkit and removed.
    Seems to be OK now!

    Hope this post could help others.
    Of course, the factory restore does not erase the HDD MBR rootkit...

    Thanks for sharing!

  • How to get the updated values of the loops while they are running

    Hello

    I am trouble with a very basic problem, how to access the updated values of the "loop FOR" during operation?  Basically, the VI I is currently working on two sub vis calls each sub VI has a loop for, and the two screws may or may not work for the same number of iterations. My goal is to read the values in each terminal within the loop of two sub VIs, in primary VI. I tried to do this using Global Variables, but in main VI it will display only the last iteration of the two value sub live. Could someone please tell me whrere I go wrong? Is there any other/better way to do this.

    I appreciate any input on this issue.  

    Pass a reference of the main VI control to the Sub screws.  See attached example.

  • Update the values in the loop after pressing OK without a control

    Hello

    in a loop, a chain of control can be changed until the user clicks the ok button. This method works.

    But the button is also assigned to toggle with the return key.

    But now, the output is not updated any more.

    Is there a solution?

    THX

    Iliale wrote:

    Attached my VI that doesn't work here.

    If I stop the loop with key then return the s text not written

    Set the control to the value of update while typing.

  • FOR loop does not update the local Variable

    I am newer to labview, and I can't wrap the head around why not a habit of local variable to update in the code if it updates on the dashboard. Anything im missing?

    Assume that you are talking about the local variable of the 'State of the cell. The terminal updates every 500ms in the small top loop, the local variable indicates simply that the indicator and thus updates also.

    The problem is "dataflow" and you need to familiarize yourself with the concept!

    Once the while loop starts, the local variable is reading and inside the loop begins. Most likely, the local variable is read before it is updated in the small loop, so most likely returns the value of a fade on the first iteration of the while loop. Now the small loop continues to go twice per second for about five seconds. Only after the loop FOR (and everything else inside the while loop) completed, the while loop will go to the next iteration, date on which the local variable is read once more, this time with the last value of the last for loop iteration of the previous iteration of the while loop.

    In summary, the local variable updates very well, it's just that the code does not read the new value around most of the time.

    Your VI is full also potential competition conditions caused by the over-use of the local variable. You need to respect the proper execution order by eliminating local variables.

    So what is the solution? Hard to say without knowing what the VI is supposed to do. Most likely, you will need to remove the inside OF the loop and use it outside while loop for everything.

  • How can I update the values out of while loop

    The LabView waveform chart updates every 0.1 sec.

    When a user clicks on a button, I want to LabVIEW to wait 5 sec and beep for 5 sec.

    Meanwhile, it should be to update permanently the wavefrorm graph.

    When I have the structure case inside the while loop, it interferes with the updates of the waveform graph.

    When I structure case outside the while loop, the structure of the case is never executed.

    What can I do?

    I thought about it using the example of design of producer/consumer model.

    http://decibel.NI.com/content/docs/doc-5404

    It allows a variable that is updated in a while loop to update outside the while loop while the loop is running.

  • Update of unique value in the loop voltage output?

    Hello

    I'm trying to use the DAQmxWriteAnalogScalarF64 function to produce a voltage constant and regular say 3V.  The program will be in a loop, and after each iteration, I would that the output voltage be increased to say 0.1V.

    So, a shortened version of my program looks like this

    float64 value = 3;

    DAQmxCreateTask

    DAQmxCreateVoltageChan

    DAQmxWriteAnalogScalarF64 (TaskHandle taskHandle, bool32 autoStart, float64, float64 value, timeout, bool32 * reserved);

    Loop

    {

    DAQmxStartTask

    DAQmxStopTask

    }

    Now of course who does not help me update the output voltage after each loop.  So I tried something like this:

    Loop

    {

    DAQmxWriteAnalogScalarF64 (TaskHandle taskHandle, bool32 autoStart, float64, float64 value, timeout, bool32 * reserved);

    DAQmxStartTask

    DAQmxStopTask

    value = value + 0.1;

    }

    My computer would crash when I try to run the program.   I have to erase and create the task in each iteration too?

    I try to avoid using the DAQmxWriteAnalogF64 function, because I need to use a sample clock in time, he and my sample clock is used for the other channel of analog output.

    Thanks for any input.

    Howard

    aNItaB,

    I tried to call the DAQmxWriteAnalogScalarF64 in a loop and freeze my computer completely and I have to restart it by pressing the Start button.

    Then, I tried to use the DAQmxWriteAnalogF64 in a loop, specifying the output as an array of one element array, and then to update an element at the beginning of each loop.  This seemed to have solved my problem for now without any computer breaks down.

    A strange thing happened was when I took your suggestion and took the StartTask and StopTask out of the loop, the computer crash problem appeared again.

    in any case, I think that my problem has been resolved, thank you very much for your responses timely and sincere help.

    Howard

  • Caught in the trap in the loop of Windows Update

    Automatic installation of updates causes computer find themselves trapped in loop waving the circle and the Configuration of the State: 3/3 (the percentage complete locks to 0).  After a period of time (1-2 minutes), the computer restarts and immediately displays the same update status screen.  He continues again and again this cycle.

    I can restore the computer to an earlier date, successfully, but if I let Windows Update automatically download a new update, I'm trapped in the loop do even once.

    Try this: change your update settings and find the problem.

    Remove the Vista updates; two ways to do this:

    Click Start > right click on computer > properties > Windows updates down the lower left corner > updates installed in the lower left corner in the next window

    > then click the one that you don't want > uninstall will appear at the top > uninstall it.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    In addition, on the page where you clicked "Installed updates", click on change settings at the top left corner it

    > Change update settings in the next page of AutoUpdate to "check for updates but let me choose etc" > OK ".

    When you take a look at pending updates, you can either download/install them one at the time, namely the update causing you problems.

    > or if you do not need an individual > right-click on > UAC prompt > hide it

    See you soon.

    Mick Murphy - Microsoft partner

  • Update Windows stuck in a loop. Keeps trying to download page 3 of 3, but never does, then restarts and is trying to download. Can't seem to put an end to the loop.

    Update Windows stuck in a loop. Keeps trying to download page 3 of 3, but never does, then restarts and is trying to download. Can't stop the loop to try something else.

    The operating system is Windows Vista.

    I found this as a solution and to share it here, I still have questions, but thinking might help someone.

    Windows Vista and 7 update Reboot Loop Fix

    Symptom: You have a update that is causing Windows Vista or Windows 7, stuck in an infinite loop. The problem usually manifests as a "step 3 of 3:0 % complete...". "followed by a restart which starts at the exact same message, not allowing you to get on your account of connection or a desktop at all. It's a pain, and he doesn't stop, even in Mode without failure or advanced trying last good known Configuration in the start menu.

    Here is the short version for people who know how to get to tools to do this and if run System Restore from the installation DVD does not work: DELETE files

    \Windows\WinSxS\cleanup.XML AND (as applicable)

    \Windows\WinSxS\pending.XML and the infinite loop update will be set.

    There are two ways to get the files, you need to delete. The easiest is to start your installation of Windows and the button 'Install now' DVD, click on the link located at the bottom left that says 'Repair your computer' open a command prompt and type:

    del C:\Windows\WinSxS\cleanup.xml

    del C:\Windows\WinSxS\pending.xml

    The other way is to download a live Linux distribution such as the System of Tritech Service (which, unlike Vista or 7 DVD, can be booted from a USB flash drive for computers with no CD/DVD drive such as netbooks), open a command prompt, mount the file system and deleting the files. Assuming that your Windows installation is the first partition on the first hard disk, the following commands in rxvt or a console in the Tritech Service system should work:

    Mount.NTFS - 3 g/dev/sda1/mnt/sda1

    RM /mnt/sda1/Windows/*/cleanup.xml /mnt/sda1/Windows/*/pending.xml

    umount/mnt/sda1

    discount to zero f

    Anyway you do it, this solution will stop the engine update loop reboot and let you return to your computer. You may need to make some corrections, additional or manual updates if you have problems, but unless your login screen and/or the Office should be accessible! Is a very annoying problem and I noticed that Google is looking for things like "stage of vista 3 3 restart" usually only provides information about how to run the system on a Vista DVD restore. Unfortunately, if there is a problem with an update, sometimes the system restore does not work and fail with obscure errors, so this info is vital.

    Maybe it's your last chance to avoid giving to the top and reinstalling Windows, and we always like avoiding relocations!

  • Windows Vista is stuck in the loop of update, install update 3 of 3, 0% complete.

    I don't have a Vista CD and I can not function in safe mode because it continues to bring back me to the loop. Please notify.

    Hello

    1. you made any hardware or software changes to the computer?

    2. which update is installed?

    3. have you started the installation of updates?

    You can try the troubleshooting provided in the link steps to solve the problem.

    Error: Failed to setup of the Windows updates. Restoration of the changes. Do not turn off your computer when you try to install Windows updates

    http://support.Microsoft.com/kb/949358

    Note: If the steps above do not work, you will need to contact your hardware manufacturer.

    Registry warning

    To do: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    322756 (http://support.microsoft.com/kb/322756/)

    How to back up and restore the registry in Windows

    I hope this helps.

  • My computer is stuck in the loop "Update Configuration". Boots only in safe mode.

    My computer is stuck in the loop "Update Configuration". Boots only in safe mode. I tried to do a system restore, but an error message appears that says:

    To perform an offline system restore, you must specify which Windows installation you want to restore. For example, if the installation is in "C:\Windows:" should be restored, enter the following command: rstrui.exe/OFFLINE:C\Windows

    I typed in the "run" command, and it didn't work either. VIsta came installed on the computer, so I don't have a disc to insert and reboot with. Help, please!
    Thanks, Ben

    OK, I found how to fix this problem.

    Go to this site download and buy the repair for Vista disc. Burn it to a disc.
    This link will guide you in burning instructions
    http://NeoSmart.NET/wiki/display/G/Burning+ISO+images+with+ImgBurn
    Start your computer with the disk and follow the instructions
    http://NeoSmart.NET/wiki/display/G/Burning+ISO+images+with+ImgBurn
  • When I check the updates, it goes into endless loop and never off.

    Original title: windows updates

    When I check the updates, it goes into endless loop and never off. Even if there is no new update, he said usaly. What is gpoing?

    Please run the Windows Update Troubleshooter:
    http://go.Microsoft.com/?linkid=9830262

    Please provide details of any problem it reports as not fixed.

  • GroupDataModel - update the Chronogram of loop without going through a row.

    Hello

    I need to update a child recordset within a GroupDataModel. At first, I update the selected record, but there may be a notebook of the child requiring an update of data in order to take account of the appropriate user interface.

    So I loop trought all of my folders and find those corresponding, but the problem I do face is updateItem() method requires a row position. I guess I have to build the path to the index? Or y at - it another way to update the corresponding records?

      // Extract all records
      QList records = m_dataModel->toListOfMaps();
    
      // Loop and start looking for any possible match
      for (int i = 0 ; i < records.size(); i++)
      {
        QVariant record = records.at(i);
        QVariantMap map = record.toMap();
    
        if ()
        {
          map["myField"] = QVariant("Updated Record");
          // UpdateItem requires an indexPath... but since I'm looping throught       // each item the indexPath is unknown.      //m_dataModel->updateItem(indexPath, itemMap);
        }
      }
    

    OK, thanks for the pointer... I did some research some of the example project, but @ the end I found this thread...

    https://supportforums.BlackBerry.com/T5/native-development/GroupDataModel-how-to-find-an-item-and-GE...

    ... and @ there end, I used this approach:

      // Extract all records  QList records = m_dataModel->toListOfMaps();
    
      // Loop and start looking for any possible match  for (int i = 0 ; i < records.size(); i++)  {    QVariant record = records.at(i);    QVariantMap map = record.toMap();
    
        if ()    {      // Search for this matching record...      QVariantMap matchMap;      matchMap["Field1"] = map.value("Field1").toString();      matchMap["Field2"] = map.value("Field2").toString();      matchMap["Field3"] = map.value("Field3").toInt();      QVariantList indexPath = m_dataModel->lowerBound(matchMap);
    
          // Now that we have determined the index path, we must update the record...      QVariantMap itemMap = m_dataModel->data(indexPath).toMap();      itemMap["FieldToUpdate"] = QVariant("Updated Record"));      m_dataModel->updateItem(indexPath, itemMap);    }  }  
    
  • only the update by removing for cursor loop

    Hello

    I have the cursor for loop below update a flag. Need to convert the single update by removing the loop.

    po_date po_number BLACK flag

    123 123 - 1 12 December 2015

    123 123 - 2 December 15, 2015

    123 123 - 3 December 21, 2016

    Result

    =====

    po_date po_number BLACK flag

    123 123 - 1 12 December 2015 MUL

    123 123 - 2 15 December 2015 MUL

    123 123 - 3 December 21, 2016

    So, if there are several BLACK for a PO_number, then Mark flag = "MUL" for the two records which are min as the max po_date.

    I'm in select * from alm_po_quotes

    loop

    Update alm_po_quotes

    flag of the value = 'MUL '.

    where po_number = i.po_number

    and

    po_date < (select MAX (po_date) in the alm_po_quotes where po_number = i.po_number);

    end of loop

    Commit

    Please notify.

    Thank you

    In your update, simply add the clause as below

    -Statement to merge

    MERGE INTO alm_po_quotes apq

    USING (SELECT MAX (po_date), mxpo_date,

    APQ.po_number

    Of alm_po_quotes apq

    GROUP BY apq.po_number

    After HAVING COUNT (DISTINCT apq.crno) > 1

    ) q1

    WE (apq.po_number = q1.po_number

    AND apq.po_date<>

    WHEN MATCHED THEN

    UPDATE SET apq.flag = 'MUL '.

    ;

    -Update statement

    UPDATE alm_po_quotes apq SET apq.flag = 'MUL '.

    WHERE apq.po_date< (select="" max(po_date)="">

    Of alm_po_quotes apq1

    WHERE apq.po_number = apq1.po_number

    GROUP BY apq1.po_number

    After HAVING COUNT (DISTINCT apq1.crno) > 1

    );

    OUTPUT:-

    =======

    PO_NUMBER CRNO PO_DATE FLAG
    123 123 1 12/12/2015 MUL
    123 123 2 15/12/2015 MUL
    123 123 3 21/12/2016 -
  • Question about the update of a cursor for loop

    Hi, please someone could help with the following:

    I have a simple script below:

    declare

    cursor c1 is select name, salary of employers;


    Start

    for rec loop c1

    dbms_output.put_line ('employee' |) Rec.Name | ' s former salary was £' | Rec.salary);

    update of employers set salary = salary * 1.2 where name = rec.name;


    dbms_output.put_line ('employee' |) Rec.Name | "new treatment is £' | Rec.salary);

    end loop;

    end;

    This gives me the old value of the salary, but the output for the new salary remains the same, that is to say, it has not increased by 1.2.

    Ive tried to run in the 2 loops that works, but does not give me in order I want, IE employers followed old sal nine.

    Ive tried to add is committed and various other things, but it makes no difference. I thought that the script above should work. Where I'm going wrong?

    Thank you very much

    882839 wrote:

    I learned (perhaps wrongly) that cursor for loops were good practice. Is it not the case?

    Could you mention who told you this?

    I'm curious because on a daily basis in almost all the sons of my treatment is slow , the reason for the slow transformation is the loop and all responses point out that you are using a loop ensures that the process is running more slowly as possible.

    But despite any response in this community saying loops are the worst practices, every day more people come here apparently having learned exactly the opposite and then wonder why their program runs like a dog three legs with an anchor attached to his tail.

  • Samples buffered not updated in the loop For

    Hello.

    I'm having some trouble with DAQmx Read.

    I have 2 cards USB 6509 making a digital output to solve some multiplexers and I want to measure differential voltage

    using 2 boards of 6255 USB. I have a sample clock shared for 6255 boards through a PFI line. Unfortunately

    6509 boards do not allow for the synchronization of hardware I can say.

    So, to synchronize the functions I used a flat sequence to ensure that multiplexers are processed before acquiring the data of voltage

    and as you can see on the VI (LabVIEW 8.6) I use a loop to run 16 iterations and build a table with these data.

    The problem is that sometimes I get is error 200287 or 200010. And when I don't get an error, the data of 16 iterations

    is the same and it is incorrect because I'm monotoring the data to enter into the 6255 boards using a multimeter and data do not match.

    I seems to me that the analog input is read-only data iteration and I can't understand why.

    Also this VI takes a long time to run and it freezes for a few seconds on a few iterations.

    Can someone take a look at the VI and enlighten us please?

    I'm really stuck on this part.

    Thanks in advance.

    See you soon.

    Rui

    Rui,

    Well-that the code has sufficient space to improve performance!  Other than samples obvious to read the error that was made out, I recommend:

    • Use "master of task.vi" to commit the task before starting the loop - as you have tasks enter the loop 'unverified' and so for each iteration tasks are verified, reserved, committed, started, stopped, no committed, without reserve and unverified. That's a lot of unnecessary work behind the scenes!
    • Do not pass 30000 as a sample to the slave task rate HAVE read the actual sampling frequency of the main task of a task property node and pass a LARGE value this actual sampling frequency to the task of the slave (sample rate can get under duress and you cause a bit of a problem)
    • Bring your constants out of the loop, that the 8.6 compiler doesn't have some of the modern optomizations available for reading constant each iteration is frowned on
    • Check your version of DAQmx.  You want more 9.1 to avoid the bug of the autostart.

Maybe you are looking for