BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-13-2008, 09:48 PM   #1 (permalink)
New Member
 
Join Date: Nov 2006
Location: New York, NY
Model: 8300
Carrier: AT&T, T-Mobile
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
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


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Generic TL866A Universal Programmer USB EPROM EEPROM FLASH BIOS 8+1 Adapter
$105.95
Generic TL866A Universal Programmer USB EPROM EEPROM FLASH BIOS 8+1 Adapter picture(1PCS) STM8S105K6U6 MCU 32KB FLASH EEPROM 32-VFQFPN 8S105 STM8S105
$3.05
(1PCS) STM8S105K6U6 MCU 32KB FLASH EEPROM 32-VFQFPN 8S105 STM8S105 pictureNEW Adept Memory Card 32KB EEPROM # FMCE32 90400-02200 -- BNIB
$285.0
NEW Adept Memory Card 32KB EEPROM # FMCE32 90400-02200 -- BNIB picture(5PCS) S-93C66BD0I-T8T1G IC EEPROM 4KBIT 500KHZ 8TSSOP 93C66 S-93C66
$6.33
(5PCS) S-93C66BD0I-T8T1G IC EEPROM 4KBIT 500KHZ 8TSSOP 93C66 S-93C66 pictureLot of 2 Catalyst 1K-Bit Microwire Serial EEPROM CAT93C46 96C46LI
$0.76
Lot of 2 Catalyst 1K-Bit Microwire Serial EEPROM CAT93C46 96C46LI picture






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