Update screen from a Thread.

Hello

is it possible to update the current screen of a Thread?

I tried with a pushScreen but thit causes the termination of the Thread...

I also tried a second Thread that reads the information in the first Threads

Output array, but it worked...

creation of the "screen" with smth like that

while ThredIsBusy == true{
  //Update Gui
}

does not work too...

the Thread takes about 1 Minute, if I want to display information

on the progress in the graphical interface.

Any ideas?

dognose

well, I was able to produce a solution of 'work '. I don't know if its good or bad, but it works:

First of all, with beginning of thread, I show the status screen once and start the update screen Thread "wait."

/*This is the Thread taking a time*/
GlobalDataStore.AllTracks.start();

/*This is the boolean we use later*/
GlobalDataStore.ThreadIsRunning = true;

/*Display a instance of "waiting Screen"*/
Screen waiting = new waitPlayListScreen();
UiApplication.getUiApplication().pushScreen(waiting);

/*Start the second Thread, that updates the "Waiting Screen"*/
GlobalDataStore.Waiter.start();

It's Source code, I used for my "screen pending update.

public void run() {
       /*This is the boolean set on thread start*/       /*While, cause it should stop, when Thread 1 is finished*/       /*Thread 1 sets the boolean flag on false at end*/
       while (GlobalDataStore.ThreadIsRunning == true){            UiApplication.getUiApplication().invokeAndWait(new Runnable(){
                public void run(){           /*Close "current wait Screen"*/
                    Screen sr = UiApplication.getUiApplication().getActiveScreen();
                    sr.close();

         /*And push new one. Information is update by functions that are called             in the constructor of the waitscreen*/
                    UiApplication.getUiApplication().pushScreen(new waitPlayListScreen());

                }});
            try {
                Thread.sleep(1000);
            }
            catch (InterruptedException ioe) {
                GlobalDataStore.EventLog.Append("Exception While Thread Sleeping: " + ioe.getMessage()); //log
            }
        }
    }

Tags: BlackBerry Developers

Similar Questions

  • Update a field from a Thread - IllegalStateException

    Hello

    I'm IllegalStateException I would like to aid in prevention.

    Inside of my program is a screen containing an ObjectListField, to which I added an Update() method. Inside of the Update() method, I call this.set () and this.setSelectedIndex (). When I call Update() of a second Thread I created, the IllegalStateException is called on this.set () or this.setSelectedIndex () calls. As I understand the debugger, the exception is thrown on a call to. assertEventLock().

    I'm not too familiar with the competition, which is probably part of the problem. How do I structure my program so that I can keep the ObjectListField updated with the wire sometimes change the data that shows the ObjectListField?

    Thank you

    To ensure that only one process will update your user interface at some point, you must be running on the event Thread or have the locking of the event before the update of your user interface.

    If you can not immediately update from a background Thread, you need a bit of magic first.

    The best thing to do for you, it's surround your call update() with the following code:

    UiApplication.getUiApplication (new Runnable() {})

    public void run() {}

    Update (.);

    }

    });

    To understand the theory, review this video

    http://www.BlackBerry.com/DevMediaLibrary/view.do?name=WhatistheEventThread

    and this tutorial
    http://www.thinkingblackberry.com/archives/182

    One last thing, there are many references to the Exception you have on this forum.  Next time, I suggest that you search on the forum for an answer to your question before posting.  May that have saved you some time, as I suspect at least one of the mentions that you found would have answered your question.

  • How can I change screen from vertical to horizontal orientation?

    How can I change screen from vertical to horizontal orientation? It will not work after you install the update.  I have an Iphone 5s.

    Swipe up from the bottom of the screen to bring up the control center. Then press the icon that looks like a padlock inside a circular arrow. -AJ

  • How to change the screen from Portrait to landscape?

    I changed my screen from landscape to portrait years ago and now I can't go back.  My screen went out and I use a borrowed on the side for now, quite the hassle.  Any ideas?

    Hi DavidMortensen_907,

    • What happens when you connect your monitor to the computer?

    I suggest that you connect the monitor for which you want to change the portrait view and then go to the link thread with similar problem and try the steps mentioned, check if it helps.

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-desktop/switching-between-portrait-and-landscape-display/9bdea91e-3e86-4e19-9E23-97193b63e5cd

  • My keyboard is missing after update screen.

    My keyboard is missing after update screen. It comes when I do the system restore, but disappears again when I turn on the computer and it will update again.

    11 updates have been installed. I couldn't find 10.

    Adobe Reader XI (11.0.10)
    Update for Microsoft Windows (KB3014406)
    Update of security for Microsoft Windows (KB3013126)
    Hotfix for Microsoft Windows (KB3009736)
    Update of security for Microsoft Windows (KB3008923)
    Update for Microsoft Windows (KB3014394)
    Update for Microsoft Windows (KB2952664)
    Update for Microsoft Windows (KB3006121)
    Update for Microsoft Windows (KB3006625)
    Update for Microsoft Windows (KB3013410)

    Notice that I get:

    How can I get the keyboard screen on back?

    Remove KB3004394 from Windows updates and reboot. It has caused many problems.
     
    Go to the updates of Windows. It should appear in the start menu. All programs, or you can find it in the control panel.
     
    Click view update history and installed updates. In the search bar type in KB3004394. When it shows the update, do a right click on it and uninstall it.
     
    Microsoft has released the update if you do not have to worry about coming back.
     
     
  • MenuItems run() method that is called from the thread eventdispatching?

    Hello

    is it? I know that MenuItem itself extends thread, but I wonder why this method is called run() and finally and above all it would'nt be worse if this method would be called from a Thread.

    THX

    In fact the menu items are run on the thread of the event. You can see this by creating a menu item long-term. The menu will not close and will not refresh the screen.

  • Cursor starts moving across the screen from left to right after the wake up the computer from standby or hibernation

    Original title: cursor goes wild

    My PC to 'wake up' sleep/hibernate, the cursor initially moving across the screen from left to right, in which window is open, destroy all the document is on the screen. I force Windows to close. How to solve this other than turning off standby/hibernation?

    Looks like the cursor of the mouse is very sensitive when the computer comes out of standby or hibernation.
    I suggest that you go in the mouse properties and lower the sensitivity and see if that helps.
    You also need to update any driver mouse if possible.

    Let us know if that helps.

    Marilyn

  • Widget of composition to be full screen from left to right

    Hello

    I would like for my composition widget to be full screen from left to right with the browser window, but fixed a height. Does anyone do this? Thank you.

    See this thread for suggestions on how to achieve something like this using jQuery plugins.

    http://forums.Adobe.com/message/5407836

    Thank you

    Vinayak

  • Problems of updating Flash from Adobe

    I constantly get popups saying "firefox has prevented the obsolete plugin adobe flash of opening", but I can't seem to update the plugin.

    I tried to go through firefox for the website https://www.mozilla.org/en-US/plugincheck/ , but all I get is a spinning wheel. I tried to clear my cookies and refreshing firefox to fix it, but I always get the spinning wheel so I can't update my plugins via the Web site of firefox.

    Then, I went and downloaded the update directly from Adobe, but when I try to install I get an error message saying "your internet browser microsoft explore includes the latest version of adobe flash player" and it won't let me complete the installation. I checked that firefox is my default browser, but I still get the error message.

    I looked through many discussions on this help site, and nobody seems to have these two problems. They can update via the Mozilla Web site after updating to Firefox, or they have the fixed problem when updating through Adobe.

    I'm in Windows 8. Thank you

    http://www.Adobe.com/CA/products/flashplayer/distribution3.html

    Looks like you were trying to install the ActiveX version that is only for IE and not the version of database plugin for browsers like Firefox/SeaMonkey.

    Plugins like Flash, Java, Shockwave etc are installed on the system and not in Firefox and Firefox makes use of these Plugins.

  • Anyone else having problems updating apps from the app store?

    Anyone else having problems updating apps from the app store?

    I have the problem. I'm running on iOS 9.3.2... I have 29 apps waiting for update, but its not updated. No matter what fix on this yet?

  • How can I prevent the annoying "Hooray!" "Your Firefox is updated" screen/tab to appear whenever I start Firefox?

    Whenever I start Firefox the boring "Hooray!" "Your Firefox is updated" screen/tab is displayed. I know that it is up-to-date. How can I stop this?

    Hi STALMIKI,

    You should look at this article on this specific issue and Preferences not savedarticle. It should give you all the information you need!

    If this does not work:

    1. Enter about: config in the address bar
    2. Click I'll be careful, I promise you if prompted
    3. In the filter field, type Startup
    4. Double click on startup.homepage_override_url
    5. Delete the text string, and then click OK
    6. Close Firefox and reopen the window to check that it worked.

    Hope this helps!

  • "I update firefox from 7 to 8 and now when I run firefox every time it opens the page 'do start with firefox', in options I select the option ' display a blank page" How can I solve this problem?

    I update firefox from version 7 to version 8, now when I run firefox every time it itself open the Web "to start with firefox", in firefox options I select the "show a blank page" but his does not work. I use firefox on windows XP - SP2.

    Try to restart Firefox, the time of a page (s) after the beginning of a new version should disappear. In fact this last time with 8.0 they did not come to the top for me.

    If it works then raise Subject: config and insert the url of the page into the filter. Right-click on anything that appears and use "Reset".

  • Update Android from 4.2 to 4.4. problem help move the image to the sd card

    After update android from 4.2 to 4.4. My slate 7 cannot copy anything from internal storage to sd card.

    Before the update, I installed the HD file manager. It is displayed "suite of files have not been glued," after the paste. Can anyone help?

    Hi Shiuyin, welcome to the Forums of HP. I understand that you are not able to copy files to the SD card after upgrade to KitKat. Android has changed their security settings, and you will probably need to find a file to upgrade Manager.

    Work with files (Android 4.4/KitKat)

  • method accewwing from another thread causes some 'bad object type' error with c# VS2008

    I'm snapping a picture to a main Viewer, draw a rectangle around an alignment and extract the part of the image to a different viewer for further processing. I tried everthing and all was good until I started to build a Wizard for the operator through the process of the market and do things automatically. If I have access to this method of the mainform thread, everything works fine. If I access it from the thread of substantive assistants work it fails and gives the error "you have provided the wrong type of object to the function. Spend a CWIMAQRectangle instead. »

    public int ExtractToGP1()

    {

    CWIMAQLearnPatternOptions LearnOptions = new CWIMAQLearnPatternOptions();
    CWIMAQRectangle RoiRectangle = new CWIMAQRectangle();

    int Count, result;

    Extract the region corresponding to the model selected in the main Viewer

    Result = axCWMachineVision1.GetSelectedRectangleFromViewer (axCWIMAQViewer1.GetCWIMAQViewer (), RoiRectangle, true, 1); //<--error>

    Result = axCWIMAQVision1.Extract2 (axCWIMAQViewer1.Image, axCWIMAQViewer5.Image, RoiRectangle, 0, 0);

    I tried to use:

    axCWMachineVision1.Invoke (delegate (MethodInvoker)

    {Result = axCWMachineVision1.GetSelectedRectangleFromViewer (axCWIMAQViewer1.GetCWIMAQViewer (), RoiRectangle, true, 1) ;})} ;

    axCWMachineVision1.Invoke (delegate (MethodInvoker)

    {Result = axCWIMAQVision1.Extract2 (axCWIMAQViewer1.Image, axCWIMAQViewer5.Image, RoiRectangle, 0, 0) ;})} ;

    but this only works if the method is called by the main thread.

    Resolved to myself. Not really a problem of OR.

    I moved

    CWIMAQLearnPatternOptions LearnOptions = new CWIMAQLearnPatternOptions();

    CWIMAQRectangle RoiRectangle = new CWIMAQRectangle();

    for my vision instead of having it in the method class, which is in the mainform class

    Then use Vision.RoiRectangle vs RoiRectangle and Vision.LearnOptions vs LearnOptions.

  • My update screen shows the last control updates has been 14.6.16 to the 08.01 and the update to install has been KB3035583 on 25.5.16 to 23.02.

    * Original title: look for the updates ms7

    My update screen shows the last control updates has been 14.6.16 to the 08.01 and the update to install has been KB3035583 on 25.5.16 to 23.02.  Since 14 June I repeatedly ran checks the updates, but these controls are never successful as never - end research I just saw the "check updates" message, but the check never ends.   Why is this?

    The Windows Update client cannot manage a KB3161664. Download and install it manually in advance. Links provided here:

    http://Wu.krelay.de/en/

    Be sure to not do a search running in background.

    Best regards, VZ

Maybe you are looking for