Thursday 3 January 2013

Blackberry beginning tutorial

Well If you are familiar with java, then you can create Blackberry programming.

Click here

https://developer.blackberry.com/java/ to download blackberry sdk 7.1

Then you will be redirected to download page,

http://swdownloads.blackberry.com/Downloads/contactFormPreload.do?code=00EC53C4682D36F5C4359F4AE7BD7BA1&dl=FF6622A42D684A5F18B53B8D94C9BE98&check1=A

Download and install it.

Your eclipse will start

Click File->New ->Blackberry Project

Enter Project name and click Finish.

In package explorer, you will find package.Inside the package you will find two class file. MyScreen.java and MyApp.java.You can rename it as your choice.

MyScreen.java is the "Application" screen and MyApp.java is "MainScreen" application class.

Let's proceed in programming..

MyScreen.java:


Import net.rim.device.api.system.ApplicationManager;

Import net.rim.device.api.ui.UiApplication;

Public class MyScreen extends UiApplication
{

Public static void main(String args[])
{

//new Instance of application

Launcher lr=new Launcher();

lr.enterEventDispatcher();

Private Launcher()
{

This.pushScreen(new MyApp() );

}

}


MyApp.java


Import net.rim.device.api.ui.component.LabelField;

Import net.rim.device.api.ui.container.MainScreen;

Public class MyApp extends MainScreen

{

//Inside the constructor,labelfield been used.
Public MyApp()

{

//I am creating a labelfield that will display in screen
LabelField lf=new LabelField();

//set the text that you want in label field.
lf.setText(“Hello world”);

//add the label field in mainscreen
this.add( lf );

}

}

To run the application. run->run project->Blackberry simulator