BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-13-2008, 09:48 PM   #1
jrebeiro
New Member
 
Join Date: Nov 2006
Location: New York, NY
Model: 8300
Carrier: AT&T, T-Mobile
Posts: 12
Default Display Dialog on startup

Please Login to Remove!

I am having trouble with the following code. I am creating a background process and would like to display a Dialog on startup. Nothing ever gets displayed. I stepped through the code and made sure that Dialog.ask gets executed but still nothing shows.

In the emulator the Media Card Insterted dialog seems to takeover the screen and my dialog gets ignored.

Here is the code:

Code:
public class GVIntercepter extends UiApplication implements SystemListener
{
    public static void main(String[] args)
    {
        // register an options provider
        GVIntercepterOptionsProvider provider = new GVIntercepterOptionsProvider();
        OptionsManager.registerOptionsProvider(provider);
        
        // register a phone handler
        PhoneHandler phone_handler = new PhoneHandler();
        Phone.addPhoneListener(phone_handler);
        
        GVIntercepter instance = new GVIntercepter();
        // instance.enterEventDispatcher();
        
        if( ApplicationManager.getApplicationManager().inStartup() ) {
          // Add a system listener to detect when system is ready and available.
          instance.addSystemListener(instance);
        } else {
          // System is already ready and available so perform your start up work now.
          // Note that this work must be completed using invokeLater because the
          // application has not yet entered the event dispatcher.
          instance.doStartupWorkLater();
        }
        // Enter the event dispatcher.
        instance.enterEventDispatcher();
    }
    
    //Invoked when the user is putting the device into a power off state.
    public void powerOff()
    { }

    //Invoked when the device has left the power off state.
    public void powerUp()
    {
      Application.getApplication().removeSystemListener(this);
      doStartupWork();
    }

    //Invoked when the internal battery voltage falls below a critical level.
    public void batteryLow()
    { }

    //Invoked when the internal battery voltage has returned to normal.
    public void batteryGood()
    { }

    //Invoked when the internal battery state has changed.
    public void batteryStatusChange(int status)
    { }
    
    private void doStartupWork()
    {
      // Perform your start up activities here!
      Application.getApplication().invokeLater( new Runnable() {
        public void run() {
          Dialog.ask(Dialog.D_YES_NO, "Display?");
        }
      } );
    }
    
    private void doStartupWorkLater()
    {
      Application.getApplication().invokeLater( new Runnable() {
        public void run() {
          doStartupWork();
        }
      } );
    }
        
    public GVIntercepter()
    {    }
}
I'm using JDE 4.2.1.

Any ideas?
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Lot of OEM APPLE iPAD LCD And White Front Glass Replacement 6091l-1402C picture

Lot of OEM APPLE iPAD LCD And White Front Glass Replacement 6091l-1402C

$17.99



A1618 NEW OEM Battery for MacBook Pro 15

A1618 NEW OEM Battery for MacBook Pro 15" Retina A1398 Mid 2015 020-00079

$43.90



Genuine A1417 OEM Battery Apple Macbook Pro 15 Retina A1398 Mid 2012 Early 2013 picture

Genuine A1417 OEM Battery Apple Macbook Pro 15 Retina A1398 Mid 2012 Early 2013

$40.90



NEW OEM Battery A1466 A1369 A1496 A1405 A1377 A1466 for MacBook Air 13 inch picture

NEW OEM Battery A1466 A1369 A1496 A1405 A1377 A1466 for MacBook Air 13 inch

$31.90



OEM Battery for MacBook Pro 17

OEM Battery for MacBook Pro 17" A1309 A1297 Early 2009 Mid 2009 2010 MC226

$40.90



NEW OEM A1618 Battery for Apple MacBook Pro 15” Retina 99.5Wh A1398 Mid 2015 picture

NEW OEM A1618 Battery for Apple MacBook Pro 15” Retina 99.5Wh A1398 Mid 2015

$43.90







Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.