QML pauses while you wait thread.

I have a connection that the screen when you press the "CONNECT" button, I want the buttons disappear and to display a progress bar.

My code when you press LOGIN:

Set the visible property of the button to false and progress bar to true visibility.

Create a thread and connect to my web service and get the answer.

Wait thread ends with pthread_join()

Handle the response and either make visible the new button or go to another part of the application.

The problem is the button do not disappear or the progress bar appears. They only AFTER the pthread_join().

Any suggestions on what I can do to fix this? I just want to prevent the user from spamming the "connect" button while he checks the connection information.

Thank you!

Updates to the user interface will not happen because you have blocked the UI with pthread_join() thread.

I did something very similar to the HelloCamera example:

https://github.com/BlackBerry/Cascades-community-samples/tree/master/HelloCamera

When the user presses the button "Take a picture", I grey out and start my threads of work (hidden inside the camera_take_photo() implementation).   When one of my sons indicates completion, I emit a SIGNAL which is intercepted by a SLOT function in my application that makes the visible button again.

I suggest that your button handler marks itself invisible or disabled, creates a thread and not to join this thread.

Instead, when that thread terminates, it should send a SIGNAL.  While your application has a SLOT Manager related to this signal, which makes the visible button again and joins in your thread.

In short... SIGNALS and SLOTS is your solution.

See you soon,.

Sean

Tags: BlackBerry Developers

Similar Questions

  • ORA-00060: Deadlock detected while you wait the cursor CLOSE resource

    Hello

    I am a new Member of this forum. I work with a problem that we have obtained a few weeks ago. It runs in the lot C Pro executable on 10 threads dealing with > 800 data accessed from more than one table. The error, such as reported was a package.function call.

    This is the error I encountered:
    process_item ~ G *, D * ~-60 ~ ORA-00060: Deadlock detected while you wait resources ~ PACKAGE ERROR = cursor CLOSE C_ * in the R package *. I * 7641

    The slider is a simple SELECT without Table or record locking.

    My questions are:
    * During the occurrence of this error, execution is already in the line of the CLOSE cursor or did the error has occurred between the OPEN and the CLOSE slider? There are several lines of code between the OPENING and CLOSING:
    -one who calls to a package.function that simply stores the values of parameter to a variable
    -another one that retrieves the cursor. The group that contains the values of the cursor is used only by a single function in the package

    * Is it possible for this CLOSE cursor cause a deadlock? What could have caused this?

    * From what I know, Oracle treats blocks by abandoning the blocking process, while others continue, but this impasse caused our program to hang. How is that possible? The origin of the impasse might be our Threading program? This is a rare event and has past that twice this year.

    Thank you
    RAF

    RAF Serrano wrote:
    I see, so it be that blocking has occurred before the CLOSE cursor or it occurred during CLOSING? The cause could be executable ProC

    first cause is NOT ProC

    or is it really an error in PL/SQL

    first cause is NOT PL/SQL.

    cause of ORA-00060 is DML (INSERT, UPDATE, or DELETE)

  • ORA-00060: Deadlock detected while you wait resource

    Hello

    I have a trigger to an underlying table. It fires after that insertion of the events in the underlying table. When I try to update some columns in a table underlying even within the trigger, I get the error below.

    ORA-00060: Deadlock detected while you wait resource

    Can anyone clear or correct me.

    Thank you

    Ignore the Aurélie. It is just a spammer who is trying to promote some criminal website.

    A deadlock occurred if two different sessions lock resources. Each session can wait the other session ends.

    I suppose that you set up a trigger and use the 'autonomous transaction' wrongly to a commit. This function creates a new session. Now you have two (or more) session that could create deadlock. Committing inside a trigger from the table is ALWAYS bad (with some exceptions).

    Solution: remove the pragma of your relaxation. Then the other problems you get with it.

  • Trying to update a "Loading" label... "while you wait for a thread

    Hello, I am new to Java and BlackBerry, so it is a double learning curve for me.  I tried searching for an answer and we have tried a number of things, but I do always get the label that I update to display.  Any help would be greatly appreciated.  I have a main screen with a label field.  I start a thread, and that this thread works I loop and try to update the label as in the httpdemo example.  I do this in refreshMenuItem.  The code looks like she change the label, but the screen does not appear to refresh and show the update label.  Any advice?  Thank you.

    public class testLoadingMainScreen extends MainScreen
    {
    
       private boolean isLoading;
       private LabelField statuslabel;
    
       public testLoadingMainScreen()
       {
    
          LabelField title = new LabelField("Loading Demo", LabelField.USE_ALL_WIDTH);
          setTitle(title);
    
          statuslabel = new LabelField("Waiting...", LabelField.USE_ALL_WIDTH);
          add(statuslabel);
       }
    
       Public void requestSucceeded(final String message)
       {
          isLoading = false;
          updateContent(message);
       }
    
       public void requestFailed(final String message)
       {
          isLoading = false;
          updateContent(message);
       }
    
       private MenuItem _refreshMenuItem = new MenuItem("Refresh List" , 10, 10)
       {
          public void run() {
    
             //setup the status messages.
             String[] statusMsg = new String[6];
             StringBuffer status = new StringBuffer("Loading");
             statusMsg[0] = status.toString();
             for ( int j = 1; j < 6; ++j)
             {
                statusMsg[j] = status.append(" .").toString();
             }
    
             updateContent("Starting...");
    
             isLoading = true;
    
             //start the thread
             try
             {
                  testLoadingThread dispatcher = new testLoadingThread(testLoadingMainScreen.this);
                  dispatcher.start();
             }
             catch (Exception e)
             {
                  System.out.println(e.toString());
             }
    
             //while thread is working, update status message
             int i = 0;
             while ( isLoading )
             {
                updateContent(statusMsg[++i%6]);
                try
                {
                   Thread.sleep(500); // Wait for a bit.
                }
                catch (InterruptedException e)
                {
                   System.err.println(e.toString());
                }
             }
    
          }
       };
    
       protected void makeMenu(Menu menu, int instance)
       {
          menu.add(_refreshMenuItem);
          menu.addSeparator();
          super.makeMenu(menu, instance);
       }
    
       private void updateContent(final String text)
       { 
    
          //synchronized(UiApplication.getEventLock()) {
          //    testLoadingMainScreen.this.statuslabel.setText(text);
          //    testLoadingMainScreen.this.invalidate();
          //}
    
          UiApplication.getUiApplication().invokeLater (new Runnable() {
             public void run()
             {
                testLoadingMainScreen.this.statuslabel.setText(text);
                testLoadingMainScreen.this.invalidate();
             }
          });
       }
    
    }//end testUImainscreen class
    
    public class testLoadingThread extends Thread {
    
        testLoadingMainScreen screen;
    
        public testLoadingThread(testLoadingMainScreen screen) {
            this.screen = screen;
            }
    
        public void run() {
    
            //put thread to sleep so I can test informative labels
            try {
                Thread.sleep(5000);
            } catch (Exception e) {
                screen.requestFailed(e.toString());
            }
    
            screen.requestSucceeded("Sucess");
    
        }//end run
    
    }//end testLoadingThread class
    

    MenuItems run in the UI thread... don't sleep() in them.  I guess that's causing your problem of update to block the UI thread.  Use rather a reason for recall with a background thread making sleep if you need regular notifications to the user interface.

    ~ NN

    Edit: On coffee/reflection, recall patterns may be overkill here... you can simply use a Timer/TimerTask.

  • While you wait for spare camera for 40 days. My k910 has speaker failure. : ()

    What a piece of crap... My k910 start failure involved while I'm waiting for spare camera... Call speaker is ok, but the media here totally dead speaker... It's my problemfull phone I've ever had... My past a706 and my wife s920 are problemless...

    Fortunately after a tried to push both the up and down button of the active again speaker volume...

  • When is it OK for looping while you wait event?

    Newbie question: in a world of logic non-blocking, when is it a good idea to loop waiting for something finish?

    For example, I am told to check to END_OF_MEDIA (via PlayerListener) to see if a song I played with ToneControl is finished. So is it possible to just create a loop and wait for it be triggered?

    Here is a very simple (albeit artificial) example. I want to play a melody (using ToneControl) twice. I play once, wait until it's done, then play again. END_OF_MEDIA tells me it's done. But have I not need to sit in a loop, then waiting for END_OF_MEDIA? Is it OK? It looks bad, but I don't know what would be the 'right' way.

    Thank you.

    Roricka

    The code I used was something called an anonymous inner class Java. Here's another version that does not use this construction somewhat obscure:

    void startTune() {    Player p = Manager.createPlayer(...);    p.addPlayerListener( new MyPlayerListener() );    p.start();}
    
    class MyPlayerListener implements PlayerListener {    public void playerUpdate(Player player, String event, Object eventData) {        if (event == END_OF_MEDIA) {            processEndOfMedia();        }    }}
    

    Note This class myplayerlistener is declared inside the MyScreen, right as well as the methods of the class and variable fields. All this has done is to convert an anonymous inner class in an inner class with a name.

    Now, it might look like you can move then comes from the MyPlayerListener class in a separate file named MyPlayerListener.java. But this does not work, at least not directly. The reason is related to one of the strange features of inner classes in Java (anonymous or not): an instance of an inner class carries with it an implicit reference to an instance of the containing class. That's why playerUpdate() can call processEndOfMedia() as if it was a MyPlayerListener member function, even if it is a member of MyScreen function. Somehow, an instance of MyPlayerListener lives a dual identity as an instance of MyScreen.

    If you want that myplayerlistener has stated in its own file (or if you want her to be a top-level class, not public in MyScreen.java or a static inner class of MyScreen), the rules of the language to say that there can be more than double-identity of nature. At this time, you cannot call the processEndOfMedia() in the same way as a MyPlayerListener instance does not have a reference to an instance of MyScreen. (In fact, it has no way of knowing that processEndOfMedia() is a function in the class MyScreen!) The way out of this is to give MyPlayerListener a way to refer to a particular instance of MyScreen. Here's one way:

    class MyPlayerListener implements PlayerListener {    private MyScreen client;    public MyPlayerListener(MyScreen client) {        this.client = client;    }    public void playerUpdate(Player player, String event, Object eventData) {        if (event == END_OF_MEDIA) {            client.processEndOfMedia();        }    }}
    

    Then, back in MyScreen, you need to change the call to the constructor:

        p.addPlayerListener( new MyPlayerListener(this) );
    

    And if you put MyPlayerListener in another package that MyScreen, you must also change the visibility of public processEndOfMedia().

    Anonymous inner classes are very convenient for these listener classes little, but they do not have the code a bit difficult to read. Put them in their own compilation units are more work, but it makes the code a little easier to manage, especially when come back you after a few months and try to understand what made you the way back when.

  • Mid-2010 MBP loses battery power while you sleep

    Hi everyone, I have replaced my MBP unibody mid-2010 with a spare battery and the laptop battery lost its battery power very quickly, during normal use and while you sleep. I contacted the manufacturer and they sent me a different battery, and the same problems continue to occur, so I suspect that something is wrong with my computer at this point.

    Above all, I had a second replacement battery installed when I wiped my computer clean and made a new fresh installation of El Capitan and the problem persists. The drain of the battery during sleep is even worse, it goes 100% to near depletion in a few hours.

    I have read several threads on these issues but can't seem to find the one that matches my computer behavior or specific settings. I'd love some help troubleshooting this! Can someone kindly walk through diagnostics on this for me please? FYI I already have:

    (1) the drive repaired/checked permissions

    (2) reset the NVRAM

    (3) reset SMC

    Thank you all and happy new year!

    First, not all replacement batteries are at the height for use on portable Macs what OWC at macsales.com has batteries that are. The other thing is in what regards the battery life is what you do. As these effects for how long you can run on battery power only.  Ranging from light to moderate to heavy use. If you have things like an anti virus program on the MBP. It will run in the background. And to a certain extent, even in standby mode. That will exhaust the battery. Mac do not need anti virus programs. The amount of programs running in the background is all to one degree or another effect battery life.

  • Z5 Premium battery drain while you sleep

    Hello

    I was the performance of battery loging for awhile, and I noticed that there seems to be little difference between the drain when using and the drain while you sleep.

    Last night my battery fell over 50% to 100% without any [major] at the time of the screen. The phone has been completely disconnected from all radio interfaces and everything should have been sleeping.

    I have a white list to alow my smartwatch 3 to work when the phone is asleep, but these are things like the Google services.

    The stats of the battery for the period when the battery went down shows.

    10% Android system,
    Operating system Android 7%
    Watch cell 3%
    Screen 3%
    Phone idle 2%
    Media server % 1.

    I don't really code that much more, but if this where a system I was debugging, I would be suspicious that Android and Android OS systems use such a big chunk of power while the system should be asleep and waiting to be activated by the interface remains alone, the connection of the cellar!

    Any thoughts on this [official or not?]

    Barry

    Tell you what, lets just call it closed should we!

  • How long should you wait for your apple account unlock

    How long should you wait for your apple account unlock?

    of > If your identifier Apple is locked - Apple supports

    ...

    When you see one of these alerts, you can go to iforgot.apple.com to unlock your account with your existing password or reset your password. After multiple unsuccessful attempts to unlock your account, your identifier Apple will remain locked and you can try again the next day.

    ...

  • How long should you wait after badly answering security questions too many times in a row

    How long should you wait after badly answering security questions too many times in a row

    How long should you wait for what? If you have temporarily disabled your account screen should say how long you have to wait until you can try again. If you mean for the reset link show on your account then does not appear if you have an e-mail address of verified relief on your account, if you have not you don't you must follow the section "If you can not reset your security questions" at the bottom of the page you have posted since

  • My daughter has an air of ipad and iphone 6 mounted on a tripod. She would like to use his phone to photograph/video while you watch on his ipad (in real time)... is it possible? If so, what adapter or cable is needed?

    My daughter has an air of ipad and iphone 6 mounted on a tripod. She would like to use his phone to photograph/video while you watch on his ipad (in real time)... is it possible? If so, what adapters or cables are needed?

    Hello!

    Unfortunately, this feature is only available with the GoPro cameras.

    And Yes, if all cables already existing for these purposes, it would be kind of a pain to take pictures and do not shake the camera accidentally. Maybe, VSCO camera makers will make such feature in some time in the future. This idea is excellent and innovative. Maybe even Apple will listen to users and make their new iOS 10.

  • BlackBerry Q10 how to navigate while you talk?

    One of my favorite features of my old Bb (on the AT & T network) has the ability to navigate while I was on a call.  I can't understand how to do this on the Q10.  Any advice?  Thank you!

    Hey,.

    It works the same as in other applications. While you are out of the call from the button upward and you will see your open, applications or your terminal or your list of applications.

    You must ensure that you are dragging, otherwise, the button "hang up" is located near the blow...

  • The application is not responding. The program can meet again if you wait. You want to put an end to this process

    Whenever logged on windows 7, I get the following message:

    "The application is not responding.  The program can meet again if you wait.
    Do you want to put an end to this process"with the choice of the end of the process and cancel.
    When I type complete the process the screen shows my wallpaper and not icons or the bar of windows at all. When I hit Cancel, the message of disappears for around one minute and shows up again.
    I can't use my phone at all in this way, so I hope you can help me.
    Sven

    Reboot the PC by using the F8 key at startup, this time select command prompt, and then follow the instructions for restoring the system;

    http://Windows.Microsoft.com/en-GB/Windows-Vista/Start-System-Restore-from-a-command-prompt

    Select a restore point to a period where it was all is OK

  • While you take the cumulative incremental backup RMAN. Meanwhile users ke

    While you take the cumulative incremental backup RMAN.
    During this time users keep be updated, insert the corresponding schema.
    But my Client doesn't backup up-to-date. Is it possible to get the up-to-date backup?
    (If I have something wrong, sorry about that, that was my interview question)

    Thanks for all,
    Kind regards
    DB

    DB wrote:
    While you take the cumulative incremental backup RMAN.
    During this time users keep be updated, insert the corresponding schema.
    But my Client doesn't backup up-to-date. Is it possible to get the up-to-date backup?
    (If I have something wrong, sorry about that, that was my interview question)

    Thanks for all,
    Kind regards
    DB

    RMAN backup is not compatible and easy to follow on-line transactions. If it's something any purpose of migration suggest taking COLD backup.
    If it's no way suggested, then after your entire + cumulative backups, however, that data will be available in archives

  • complete execution while the background thread runs

    After the passage of TestStand 4.1 in 2012, I see an interesting problem.

    I start a MainSequence via the SinglePass execution entry point using the parallel model. In ProcessSetup (in the execution of N), I start a background thread that performs certain tasks for viewing. Then the model passes by "Initialize TestSockets" and starts my MainSequence (in year N + 1).

    While the MainSequence is running, run N hangs in ParallelModel.seq > Single Pass, step "Wait for TestSockets", as it should. Usually, when the MainSequence is over, puts an end to execution and execution N goes to the next step "Check to terminate" and some time later, it passes through ProcessCleanup - where I'd send my background thread notification to stop.

    It works as long as I do not start the background thread. But when this thread is running, the execution of N + 1 never leaves the MainSequence. I arrive at a breakpoint at the end of MainSequence, ahead, and then all executions are happily showing a green light and continue to operate on. So running N never leaves "Waiting for TestSockets" and never reaches ProcessCleanup, so my son does not receive the signal of endpoint etc.

    But I distinctly remember that it worked in TestStand 4.1, and anyway, I don't understand this. Why, a background, started in the execution of N, thread prevents the execution of N + 1 to terminate?

    Concerning

    Peter

    "When execution starts a sequence in a new thread (not waiting for the thread to finish at the end of the sequence), should take care at the end of his MainSequence wire in order to put an end to herself in order for execution to terminate?"

    What do you mean by terminate? Process templates are not normally completed executions. Do you mean, "all discussions in an execution must complete before the end of the execution?"? If so, then the answer is Yes.

    I'm not completely your explanations above. I'm not sure what you mean by signs, but I think you're misunderstanding what terminate means in TestStand. Termination occurs only when a user explicitly requests a run to finish (e.g. finish all) or your sequence has an action to complete or by program initiates a terminate. Without endpoint explicit that past, executions normally end when all threads are finished executing. If you are spawning runs and new threads, you must come up with a mechanism to let them know when they have to leave. I do NOT recommend relying on or using termination for this. Termination is as abandoned (but with a cleaning), it is not intended to be something that happens in the normal flow of execution. There are several ways to tell your worker when all discussions. Perhaps this posting you are referring to is a way. You can also use a notification teststand step, or a Boolean value in reference parameter.

    Hope this helps to clear things up,

    -Doug

Maybe you are looking for