homeryansta 36 Junior Poster in Training

Hello,

I know RIM is pretty much dead, but I need help with some development. I'm currrently developing an app that pushes data to my device.

I downloaded some code that was supposedly developed by blackberry called the Emergency Contact List.

Here is my issue: The gui isn't popping up when the app runs. I believe that the code is simple enough so that you may help me figure out this issue.

The source code can be found here: http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/796557/800451/1055819...

However, here is my short version of the code just so that you can see what I'm doing.

This is the the file that contains main(). The first condition of the if statement just creates a GUI and displays it onto the screen.

/******************************************************************************************
    * main() - controls the startup of the application...thread will start in the background
    *           and the GUI starts when user clicks from main menu
    ******************************************************************************************/ 
    /**
     * <description> Starts the push data listener intially
     * @param args <description>
     */
       
    public static void main(String[] args) {
        if( args != null && args.length > 0) {
            ECLApplication theApp = new ECLApplication();
            theApp.enterEventDispatcher();
        }
        else {
            PushedDataListener.waitForSingleton().start();

        }
    }

Well, of course the inital argument is null and the length is certainly not greater than 0 so we invoke the static function "waitForSingleton".

/******************************************************************************************
* BackGround waitForSingleton() - returns an instance of a listening thread
******************************************************************************************/       
    public static PushedDataListener waitForSingleton(){
        //make sure this is a singleton instance
        RuntimeStore store = RuntimeStore.getRuntimeStore();
        Object o = store.get(RTSID_MY_APP);
        if (o == null){
            store.put(RTSID_MY_APP, new PushedDataListener());
            return (PushedDataListener)store.get(RTSID_MY_APP);
        } else {
            return (PushedDataListener)o;
        }
    }

returns the instance of the PushDataListener.

And now we invoke the start() method.

/******************************************************************************************
* start() - starts the custom listen thread
******************************************************************************************/    
    public void start(){
        invokeLater(new Runnable() {
            public void run() {
                myThread.start();
                
                //NotificationsManager.registerSource(ID_1, event, NotificationsConstants.CASUAL);//registring the object event to profiles
            }
        });
        
        this.enterEventDispatcher(); 
    //    System.out.println("here");
    }

The application is stuck running infinitely. I understand that the datalistener has to be running at all time, but how do we get the GUI to pop up? That is, how do we get the app to go into the first condition of the main method with the datalistener running in the background?

Any help would be greatly appreciated. Let me know if I'm missing some information.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.