create a new BlackBerry application. To shorten the time you read, I will go straight into the tutorial without further ado and spam links anymore. First, open Eclipse and go to the Workbench, and then click the [File]> [New]> [Project ...] New BlackBerry Project Create a New Project In the window [New Project] will appear, select the type of project [BlackBerry]> [BlackBerry Project]. Click [Next]. Select BlackBerry Project Name the project that will be created. In this tutorial, name the project 'HelloWorldApplication'. Click [Finish].
Give the name 'HelloWorldApplication' In the [Package Explorer] in the left part of Eclipse, open the project folder you created. Then right-click the [src] and select [New]> [Package] Create a New Java Package In the window [New Java Package] comes out, name the package that created. Give In the Name of Package If you've made a package, there will be a new folder under the folder [src]. Package folder is created. Now, create a new class. Right click on the package, then select [New]> [Class]. Create a New Class At the exit window, enter the name of the class that you created. Remember, the class name must be in CamelCase. ** Give the name 'HelloWorldApplication'
After creating the class, now entering its program code.
package hello;
import net.rim.device.api.ui.Field; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.container.MainScreen;
/ **
* Application class.
* / public class extends HelloWorldApplication UiApplication {
/ / Function that will be called the first time that the application is started.
/ / Must exist in one application, the maximum 1, minimum 1.
public static void main (String [] args) {
/ / Create instance of the application and enter the Event Thread
HelloWorldApplication HelloWorldApplication application = new ();
application.enterEventDispatcher ();
}
public HelloWorldApplication ()
{
/ / Create a new instance of the screen and displayed to the screen.
HelloScreen HelloScreen screen = new ();
pushScreen (screen);
}
/ / Screen class
private class extends Mainscreen HelloScreen
{
public HelloScreen ()
{
/ / Specify the title screen
setTitle (new LabelField ("App", Field.FIELD_HCENTER));
/ / Add a label to display hello world
add (new LabelField ("Hello World !"));
}
} }
When finished making the program code, it is time to run the BlackBerry application.
Tidak ada komentar:
Posting Komentar