Plan a screen several times

I want to create an application that verifies a specific value every minute in the background or when running my application. and if the value matches so I have to show my screen if my application is open.

Here's what I do:

main:

public static void main(String[] args) {
        // TODO Auto-generated method stub
        final CalenderDemoApp cal = new CalenderDemoApp(true);
        if ( args != null && args.length > 0 && args[0].equals("gui") ){
              // code to initialize the app

            cal.enterEventDispatcher();
         } else {
              // code to launch the background thread }

             ApplicationManager app = ApplicationManager.getApplicationManager();
             boolean keepGoing = true;
             while (keepGoing) {
                 if (app.inStartup()) {
                     try {
                         Thread.sleep(1000);
                     } catch (Exception e) {
                     }
                 } else {
                     keepGoing = false;
                 }
             }

             try {
                long REFRESH_TIME = (long) (1000 * 60); //   every 1 minutes
                Timer aTimer = new Timer();
                MyTask myTask = new MyTask();
                aTimer.schedule(myTask, 0, REFRESH_TIME);

            } catch (Exception e1) {
                    e1.printStackTrace();
            }         

         }
    }

MyTask.java:

public class MyTask extends TimerTask {

    // Constructor.
    public MyTask() {
    }

    public void run() {
        // TODO Auto-generated method stub

         synchronized (Application.getEventLock())
         {

            Application.getApplication().requestForeground();
            ShowCalenderScreen mScreen = new ShowCalenderScreen(UiApplication.getUiApplication());

//          Ui.getUiEngine().pushGlobalScreen(mScreen, 1, UiEngine.GLOBAL_QUEUE);
            UiApplication.getUiApplication().pushScreen(mScreen);
            UiApplication.getUiApplication().enterEventDispatcher();
         }
    }

}

and ShowCalenderScreen.java I replace the onClose() method:

public boolean onClose() {
        // TODO Auto-generated method stub

        UiApplication.getUiApplication().requestBackground();

        return true;
    }

the problem now, I face is, as I predicted the timer for each minute. but the screen appears only once and the thread is never run again...

for above instead of calling the enterEventDispatcher() method I tried even with,

Ui.getUiEngine().pushGlobalScreen(mScreen, 1, UiEngine.GLOBAL_QUEUE);

but the screen gets hanged there...

Please someone tell me what wrong I do and a specific solution for this...

Thanks in advance,

Azhar

A Solution for this, I wasn't using enterEventDipatcher() method in my Main() also I used pushGlobalScreen() to push my... crazy enough screen to me...

Tags: BlackBerry Developers

Similar Questions

  • WINDOWS 7 blue screens and boots then black screen several times through the day! View all different types of error messages. BORING

    Well, I have to tell you my story that I was happy that I bought a "new" (DELL) C.P. and 64 bit vista pre-installed and that he had not. and had some problems with my new! Dell xps 9000 from the GET go > but I learned that I was eligible for a free windows 7 upgrade and was also, said that this new victory. 7 program would solve all my problems? B.S., he transformed all senareio into a nightmare, I uninstalled it AND REINSTALLED IT 3 times not to mention having get for 7 different print drivers then reloading all antivirus, blah - blah - blah - I was on the phone with Dell for over 3 weeks now! Of course cannot use a new P.C. like this Hey? I have a file a mile long if it is "they keep a good journal at all? So I will contact the Dell for arrangements to resume their JUNK. Their so-called technical support is aweful @ best. They have me so DARN confused I can't sleep at night knowing what I had paid for my new system and still having all these questions really now this is just crazy... I have also contacted "MICROSOFT" with these problems, as I have a warranty on the win 7 program operating system and when I called the first thing of this guy's mouth was, I had to pay their money $$$ for any type of support? NOW it's sad/mad/nutz out hey? All I know is that I'm the guy with the great Bill to refund my purchase and remains sure if I can't use the c.p. I'm not paying for it! and I don't want it, that is of no use to me! Bye Bye blue screen of Messages of error and dreams MERRY CHRISTMAS to YOU ALL... OH YES HOWS THAT SAYING GO?  "BETTER DAYS AHEAD" that they will be when I'm done with DELL and MICROSOFT! It was an unreal experience more as I said a nightmare! P.S.OH YES NO MORE MIDNIGHT TECH SUPPORT CALL EITHER! CAN YOU IMAGINE THAT CALL ME AT ALL HOURS OF THE NIGHT TO FIX WHAT? NOTHING! WHAT HAPPENED TO DELL AND MICROSOFT

    Hello

    Sorry, but it seems that Dell does not provide a quality service for you. They have to replace their machine
    with a new one that is fully functional and you shouldn't accept anything less. 3 weeks and they did not
    fixed a new machine is excessive. Climbing with Dell and recover your money or a new.

    Would like power to help more.
    Rob - bicycle - Mark Twain said it is good.

  • pushed single screen several times on display battery but can not go back to the previous screen again by clicking on "back" to come to the first screen button

    Hi all

    There is a screen with meter as label, datefield and objectchoicefield in the menu drop down and add and go button, this screen is pushed repeatedly on display battery until the meter is new. But when I try to go back to the previous screen, there is problem normally by substituting the onClose() method you can pop current screen and can get the previous screen, using getActiveScreen() and then push it again if you do not override os onClose() automatically do it for you.

    But in above case when I click on the button "back" or screen previous override onclose and push, I see my first screen I wanted my current screen with the counter that is if active screen is having against label like new if I press the "back" button, it should display screen with the meter only eight and so on.

    Can someone please help me solve this problem.

    Thanks Peter for you answer, actually used function for pushscreen on stach display that was written by someone else, when I looked carefully there condtion as below,

    if (activeScreen != null) {
     Class screenClass =activeScreen.getClass();
        if (screen.getClass().equals(screenClass)) {
                        UiApplication.getUiApplication().popScreen(activeScreen);
        }
    }
    

    It's actually the previous screen of poping before push the screen from the class were same, just commented and everything works, even if you do not override onClose and press return, it will automatically displays the previous screen.

  • I get the message "paging of kernel data error" blue screen several times a week. How can I fix?

    First of all, I have an Acer Aspire 571 V3. It came with windows 8. I have had the laptop for over 2 years now and the problem seems to be getting worse. Everything worked perfectly for the first year and I only started experiences issues once I switched to Windows 8.1.  After several accidents every week, I decided to reset my laptop to factory settings, so I can return to Windows 8. Turns out, that Windows 8.1 was not the problem because they continued to occur on 8 institutions. A year of this point and I have twice now reset my laptop but the problem has not disappeared. I made sure it wasn't a virus as well since I only downloaded the bare minimum, I need for my daily activities that revolve around google chrome and meeting places.

    I also met another problem. Since the update of Windows 10 is the corner of the street, I tried updating to 8.1 again and I could book 10 Windows. But the problem now is that I can not install this update. After a long installation, I got an error (0x7007001F - 0 x 30018).

    Any help would be appreciated. If I could somehow solve this problem would be great. Thank you.

    There is a hardware problem with the HD.  I would go to the preparer hd > download and run their utility disk check

  • Windows 8, windows install keeps flashing on the screen several times only WILL NOT STOP

    Hello

    I'm having a weird bug, that I have not met before with windows install.

    I tried to install a version of MS Access 2000 Runtime on my machine to windows 8 dell inspiron 660. (The company I work again to use access 2000 Apps)

    The installation failed and basically the planted program without completing the installation.

    Immediately after what happened the windows Setup window started blinking on the screen very fast.

    I tried a system restore, the program Microsoft 'fix - it' (do not do anything), and I have restored the registry from a backup without success.

    The ONLY medium to stop flashing windows setup is to stop the windows service install, but when you start to use the pc new installer windows itself will start up and the flashing continued.

    I can't find a way to disable windows full installer (apparently windows 8 will not let you change the start type services.msc )

    Dell technical support was also no help because they wanted me to pay the money even if its in warranty.

    I'm thinking really just install xp on it and be done with this...

    HERE IS A VIDEO OF THE PROBLEM

    https://www.YouTube.com/watch?v=LHS1ELw3Olo&feature=youtu.be

    Help, please!

    Hello

    Please keep us updated.

    I understand that the Windows 8 bootable USB device is not detected during the execution of refreshment in the computer.

    You can check the BIOS for the boot priority setting if the USB device is enabled or not. Check the steps in the manufacturers Web site to change the priority of the computer starts.

    If this doesn't help, you can try to re-installation through the disk or media that you have, otherwise follow the link below.

    When you buy Windows 8 an email with the download link and purchase details will be sent to your email address that you use to purchase / register your product, you can simply access email and use the download in links for the re - download to your computer.

    Also check out the links below:

    http://Windows.Microsoft.com/en-GB/Windows-8/buy-Windows-8-online-FAQ

    http://Windows.Microsoft.com/en-GB/Windows-8/upgrade-product-key-only

    I hope this helps. Otherwise, feel free to write us again and we will be happy to help you.

    Thank you

  • Windows Installer: keeps flashing on the screen & several times by train to disappear?

    There is a small window that is popping up continuously throughout the day.  I can't even click on 'Cancel' it disappears so fast & then reappears.  She's almost schizophrenic!  He'll stop for a small period & then start again.  I don't know what to do.

    I tried the system restore, looked at the Task Manager, etc., but I'm lost... Help!

    You can try methods 3 and 4 of this article: http://support.microsoft.com/kb/2438651

    If this does not work, you could answer here a list of the programs you have installed recently.

  • My Firefox opens on a completely white screen with no menu bar or whatever it is. I uninstalled and reinstalled several times with the same problem. Help!

    I opened this morning with no problems, went to my g-mail account, pulled upwards an e-mail, click on answer, typed my respons, but when I hit send, everything went completely empty.

    I have not compressed, without... menu bars anything other than firefox upper-left logo and reduce it, full-screen/small screen and close / x buttons in the upper left corner... it's she.

    I uninstalled and reinstalled several times, but nothing works.

    What now?

    COR - el,

    Wow... that was well above my head... at least tonight. Laughing out loud

    After my last post, I did a little research and figured out how to import my favorites in IE8... so I uninstalled firefox again... but this time I had checked the "delete my personal Firefox and customizations" in the wizard, who did remove two addons (Ghosery and Ad Block Plus)... the relocation was different this time and the first time you start firefox He asked if I wanted to import my IE Favorites, which I did... I now added Ghosery and Ad Block... and if so far everything goes well... seems I got this back up and running.

    The mention of the malware in a madperson add-on has been helpful to my solve my problem.

    Thanks for the help...

  • Hello, my iPhone 6 more was having a screen unresponsive and glitchy intermittent. Ive reset it several times and it is always that I don't know what to do

    Hello, my iPhone Plus 6 has been intermittent, unresponsing and glitchin. What I mean by that is sometimes the phone will work perfectly as his guess, but eventually Pépin and become insensitive as the touchscreen doesn't work at all. The glitch usually comes hand in hand, sometimes it's not, but the problem is a bit like a time see through the layer that come from the very top of the screen; Sometimes the layer will be a single line at the top or they will appear on the top to about 1/4 of the screen and disappear and do it repeatedly. The only way that I can't seem to get the touchscreen to work and the glitching stop is either by sliding my finger quickly over the phone and or press several times the button on the lock screen. I reset the phone several times including factory and it continued to do so. I even turn off turn turn it on and press the lower screen and home screen lock button to reset it and it goes back to the same thing. I don't know what to do. Thank you for taking the time to read my comment and trying to help as much as possible, hope to hear from you soon.

    If you encounter a problem with the touch screen, you can try the troubleshooting steps in this document support. If the screen of your iPhone, iPad or iPod touch does not respond to touch - Apple Support

  • Satellite Pro L550 - 13 M - screen turns off several times

    Hello

    Strangely the portable above turned several times its screen off several times. The lights are all on, but the screen goes completely dead. During the restart, the screen is OK for about 10 minutes, then it turns off again! We rebooted several times and its been over and over again. I started in safe mode and check the latest updates AV etc, which are updated. There have not been recent software additions.
    We are now back up things just in case!

    Can anyone help with what this might be?

    Thank you!

    Hi guineverestar,

    Best way to check this problem needs to connect to an external monitor. If you notice the same behavior on external monitor it seems to be an internal hardware or software problem. Otherwise it of just the internal monitor that is faulty.

    Check this box!

  • Good day, notification of save my icloud does not close. I pressed the bottun close several times, but he's still on my screen. How this can be fixed.

    Good day, notification of save my icloud does not close. I pressed the bottun close several times, but he's still on my screen. How this can be fixed.

    Restart the device - without loss of data

    1. Restart your iPhone, iPad or iPod touch - Apple Support
  • My iPhone screen 6 is black but the phone still works as the sound goes in and out. I can't restart and have tried several times and cannot reset on iTunes because need to unlock my phone.

    I dropped my phone in a short distance and when I picked it up it the screen was black. However, the sound still works as I changed the switch works for her and he made noises. I also slightly see the apple logo when I turn on my phone and you can see the switch when I try to turn it off, but it is not entirely displayed, I can't see it in very dark rooms. I tried to reset the phone several times using the Lock and Home buttons at the same time and we have tried to connect it to iTunes to reset, but it does not connect due to having unlock my phone, I can not do. Any help would be appreciated.

    Hello CaffNutt,

    Thank you for using communities of Apple Support.

    I see that you get a black on your iPhone screen, even if it is enabled. I would recommend that you take a look at the following article:

    Get help with the screen on your iPhone, iPad or iPod touch

    The first two sections seem more relevant.

    Best regards.

  • my computer screen goes off for a few seconds and the lights without turning off the unit. This has happened several times, regardless of the period in which stays on.

    My computer operating system Mac Pro OS X EL Capitan 10.10.3, ink 13"early 2015 screen off for a few seconds and back on without turning off the unit.

    This has happened several times, regardless of the period in which stays on.

    Don't know what is happening with your publication details.  You posted in space of the Macbook Pro forum & even your profile indicates: ' MacBook Pro (retina, 13-inch, early 2015), OS X Yosemite (10.10.3)..

    Your post indicates you are using a Mac Pro, which is a desktop computer and with the help of El Capitan who is 10.11.2 not 10.10.3 which is Yosemite - 'my computer operating system Mac Pro OS X EL Capitan 10.10.3.

  • I just bought my hp pc Pavilion g series, but many times not dΘmarre; the screen remains black or blue and must strive to market several times. What is going on?

    When I turn off my pc and that you want to turn it back on, it does not work and the screen remains black or blue, sometimes but nothing else and does not

    starts up, until I have try several times in pushing and disable the power button and suddenly starts working again. The pc is almost brand new (2 weeks)

    What is going on?  Thank you very much

    Hello

    I suggest you do the repair of the system startup and check if that helps resolve the issue.

    Check the link for more information on repair system below.

    Startup Repair

    http://Windows.Microsoft.com/en-us/Windows7/products/features/Startup-Repair

    You can also check the event viewer for more information on the error message.

    Open event viewer

    http://Windows.Microsoft.com/en-us/Windows7/open-Event-Viewer

    See also:

    Resolve stop (blue screen) errors
    http://Windows.Microsoft.com/en-us/Windows7/resolving-stop-blue-screen-errors-in-Windows-7

  • Go off & on several times before the monitor turns on. Comp seems to start OK but the problem is with the screen.

    Original title: XP start help please...

    ... are to be turned off & on several times before monitor lights. Comp seems to start OK but the problem is with the screen. Do I have to make a boot disk & if so - HOW?

    Hello

    ·         What is the brand and model of the computer?

    ·         You get the error message?

    ·         Did you check the connection of the cable to the monitor?

    ·         Have you tried to update to the latest graphics card and motherboard chipset drivers?

    First, try to connect your monitor to a well known PC, maybe the old laptop that you use now. If the monitor works, the problem is with the video card in your PC. If the monitor does not light, the monitor. It is usually cheaper to buy a new monitor that in order to be an old repaired, unless the monitor is still under warranty.

    Try connecting a monitor well known to your PC. If the monitor works, your old monitor is fried and needs to be replaced.

    If your monitor works when connected to another PC, the problem could be your video card. First, and then you turn on your PC, the power and cooling case fans run they. If they do not, it could be the power supply.

    Then, open the computer case. Before you do anything inside, unplug the power supply.

    IMPORTANT! Touch any metal part of the computer case to connect to the PC. A single static spark can destroy computer circuits.

    If the video card is the type of card that plugs into a slot on the motherboard, remove the screws or attached at the top of the card, remove the card, to manipulate the card by the edges to avoid disturbing the circuits on the card, carefully and re - install the card. Sometimes simply reinstalling the card corrects the problem.

    If this does not work, replace the video card with a card of similar type. Perhaps now is the right time for an update of video card.

    If the video card is integrated into the motherboard, you can install a new card in one of the PCI slots on the motherboard. When the PC starts for the first time, go into the bios and disable the onboard video.

    Resources for troubleshooting problems in Windows XP

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

  • Can not stop the Windows Help and Support screen to appear several times

    I tried to us Windows Defender and features WindowTurn on or off programs in vain to stop the Windows Help and Support screen to appear several times offering assistance on everything that I've just selected if it is a selection of function or the word internet. The copy of Vista came with my new Dell laptop. I have another laptop HP with Vista but do not have to go through this on this subject.

    Advice to address this very frustrating situation would be appreciated.

    Hi Maree33,

    Let's run Windows Update and make sure that you have all the latest patches and service packs loaded.  In Internet Explorer click Tools then Windows Update and follow the instructions.

    You can also give a quick call Dell and see if this is a common problem with their OEM version.

    Please let us know the results.

    Brent
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for