Difference between revisions of "Teams Winter 2011/team5/lab4/tutorial"

From CDOT Wiki
Jump to: navigation, search
(Step 6 - Click Next and leave the default Java settings as it is)
 
(11 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
== Step 3 - Unzip the package in a location like: .../eclipse/mobile/blackberry ==
 
== Step 3 - Unzip the package in a location like: .../eclipse/mobile/blackberry ==
  
== Step 4 - Start Eclipse, and Go to File > New > ==
+
== Step 4 - Start Eclipse, and Go to File > New > BlackBerry Project ==
  
 
[[Image:step2.jpg]]
 
[[Image:step2.jpg]]
 +
 +
 +
 +
== Step 5 - Enter the Project Name and ensure the project specific JRE selected is BlackBerry JRE.
 +
 +
Click next ==
 +
== Step 6 - Click Next and leave the default Java settings as it is ==
 +
[[Image:step4.jpg]]
 +
 +
== Step 7 - Click Next and select an Empty Application to start developing  ==
 +
[[Image:step5.jpg]]
 +
== Step 8 - Click Finish and on the Application Tab, enter the Title for your application ==
 +
[[Image:step6.jpg]]
 +
== Step 9 - Expand the file structure in the Package Explorer window and examine the structure already created for you ==
 +
[[Image:step7.jpg]]
 +
== Step 10 - src folder will contain your package(s) and all your application code files. ==
 +
[[Image:step8.jpg]]
 +
== Step 11 - res folder is the resources folder which can contain additional resources your app might use - like images, audio or video files, or the app icon ==
 +
 +
== Step 12 - Expand your src folder and double click the .java file to begin editing ==
 +
== Step 13 - It will look like it does in the screenshot above. It will have to be edited to make it the start screen where you app starts ==
 +
== Step 14 - This is done by extending UiApplication class, which will co-ordinate the screen that is currently on top of the screen stack ==
 +
== Step 15 - We have also added some code to create a new instance of the application and make the currently running thread the application's event dispatch thread in the main function ==
 +
== Step 16 - In the constructor of the App's main class file, we push a new screen onto the top of the screen stack ==
 +
== Step 17 - The name of the new class created, which will be the first screen of the app is specificed int he pushScreen method ==
 +
 +
== Step 18 - Right click the package, and create a new Class, called MyScreen ==
 +
[[Image:step9.jpg]]
 +
== Step 19 - MyScreen will be the first screen of the app and here we can configure a screen title and anything else we want to start the app with ==
 +
[[Image:step10.jpg]]
 +
== Step 20 - In this tutorial, we create a button, defined as an instance variable of the MyScreen class ==
 +
== Step 21 - We set the current class to be the listener for any changes in the state of this button and assign it a title ==
 +
 +
== Step 22 - The button is added to the screen, which is a UiApplication object ==
 +
== Step 23 - In the field changed method, we push another screen into view when the button is pressed ==
 +
== Step 24 - The LocationTracker class is pushed into view and so it also extends the MainScreen class ==
 +
[[Image:step11.jpg]]
 +
== Step 25 - To get the location of the user in the LocationTracker class, we need to have a class that gets the users location  ==
 +
== Step 26 - The MyLocationListener class implements LocationListener, so the class can be notified as the users location is updated ==
 +
[[Image:step12.jpg]]
 +
== Step 27 - The locationUpdated method gets the latitude and the logitude of the user and saves then in two instance variables of the MyScreen class ==
 +
== Step 28 - In the LocationTracker class, we define some RichTextFields to output the collected value of the latitude and longitude ==
 +
[[Image:step13.jpg]]
 +
== Step 29 - We also create a BitMap object and configure its weight and height using the methods defined in the BlackBerry docs ==
 +
== Step 30 - The BitMap object, SeparatorField object and RadioButtonField objects are added to the screen ==
 +
 +
== Step 31 - We add a new button that will process the results of the radioButtons ==
 +
== Step 32 - The button's field change listener method is coded to alert the user based on their radiobutton value selected ==
 +
 +
== Step 33 - Import all required packages and resolve anyother warnings suggested by Eclipse ==
 +
[[Image:step14.jpg]]
 +
== Step 34 - Once all errors are resolved, Click on Run, go to Run as and then BlackBerry Simulator ==
 +
[[Image:step15.jpg]]
 +
== Step 35 - Expand on the apps in the simulator, and select the app just created ==
 +
 +
[[Image:step16.jpg]]

Latest revision as of 22:56, 15 April 2011

Contents

Step 1 - Download BlackBerry Plug-in for Eclipse and Simulator from here: http://us.blackberry.com/developers/javaappdev/

Step1.jpg


Step 2 - Download BlackBerry Plug-in for Eclipse and Simulator from here: http://us.blackberry.com/developers/javaappdev/

Step 3 - Unzip the package in a location like: .../eclipse/mobile/blackberry

Step 4 - Start Eclipse, and Go to File > New > BlackBerry Project

Step2.jpg


== Step 5 - Enter the Project Name and ensure the project specific JRE selected is BlackBerry JRE.

Click next ==

Step 6 - Click Next and leave the default Java settings as it is

Step4.jpg

Step 7 - Click Next and select an Empty Application to start developing

Step5.jpg

Step 8 - Click Finish and on the Application Tab, enter the Title for your application

Step6.jpg

Step 9 - Expand the file structure in the Package Explorer window and examine the structure already created for you

Step7.jpg

Step 10 - src folder will contain your package(s) and all your application code files.

Step8.jpg

Step 11 - res folder is the resources folder which can contain additional resources your app might use - like images, audio or video files, or the app icon

Step 12 - Expand your src folder and double click the .java file to begin editing

Step 13 - It will look like it does in the screenshot above. It will have to be edited to make it the start screen where you app starts

Step 14 - This is done by extending UiApplication class, which will co-ordinate the screen that is currently on top of the screen stack

Step 15 - We have also added some code to create a new instance of the application and make the currently running thread the application's event dispatch thread in the main function

Step 16 - In the constructor of the App's main class file, we push a new screen onto the top of the screen stack

Step 17 - The name of the new class created, which will be the first screen of the app is specificed int he pushScreen method

Step 18 - Right click the package, and create a new Class, called MyScreen

Step9.jpg

Step 19 - MyScreen will be the first screen of the app and here we can configure a screen title and anything else we want to start the app with

Step10.jpg

Step 20 - In this tutorial, we create a button, defined as an instance variable of the MyScreen class

Step 21 - We set the current class to be the listener for any changes in the state of this button and assign it a title

Step 22 - The button is added to the screen, which is a UiApplication object

Step 23 - In the field changed method, we push another screen into view when the button is pressed

Step 24 - The LocationTracker class is pushed into view and so it also extends the MainScreen class

Step11.jpg

Step 25 - To get the location of the user in the LocationTracker class, we need to have a class that gets the users location

Step 26 - The MyLocationListener class implements LocationListener, so the class can be notified as the users location is updated

Step12.jpg

Step 27 - The locationUpdated method gets the latitude and the logitude of the user and saves then in two instance variables of the MyScreen class

Step 28 - In the LocationTracker class, we define some RichTextFields to output the collected value of the latitude and longitude

Step13.jpg

Step 29 - We also create a BitMap object and configure its weight and height using the methods defined in the BlackBerry docs

Step 30 - The BitMap object, SeparatorField object and RadioButtonField objects are added to the screen

Step 31 - We add a new button that will process the results of the radioButtons

Step 32 - The button's field change listener method is coded to alert the user based on their radiobutton value selected

Step 33 - Import all required packages and resolve anyother warnings suggested by Eclipse

Step14.jpg

Step 34 - Once all errors are resolved, Click on Run, go to Run as and then BlackBerry Simulator

Step15.jpg

Step 35 - Expand on the apps in the simulator, and select the app just created

Step16.jpg