Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Member
Posts: 1
Registered: ‎08-01-2011
My Device: 8900 curve
My Carrier: Orange

Unsure about some simple code

Hey guys I'm just wondering if you can clear up some piece of code for me.


I'm following this tutorial here:



under point '5' where it says "in the constructor we will create a new Screen object and display it(figure12)"

there is a snippet of code I'm not really sure about since I haven't written in java for a while.


Its simply this:


public static void main(String[] args)
HelloWorld theApp = new HelloWorld();
public HelloWorld()
//display a new screen
pushScreen(new HelloWorldScreen());


I'm just woundering where it says:


HelloWorld theApp = new HelloWorld();


is it creating a new instance of "HelloWorld"? Or something like that? And how can it be used?


Its confusing me quite abit for something so simple :/


cheers guys Smiley Happy

Posts: 146
Registered: ‎07-24-2008
My Device: none
My Carrier: none

Re: Unsure about some simple code

yeah its creating a new instance of HelloWorld.
I am not sure whats confusion you have in this. The HelloWorld class must be extended from UiApplication or Application class.
You are creating object of this class and registering this object for receiving events by calling entereventdispatcher method. Also you can get this object by calling method UiApplication.getUiAplication() or Application.getApplication().

Thanks & Regards,
Ankit Dubey
Module Lead Software Engineer, mLabs
Impetus InfoTech (India) Pvt. Ltd.