Presentation is loading. Please wait.

Presentation is loading. Please wait.

V0.01 © 2009 Research In Motion Limited Introduction to Java Application Development for the BlackBerry Smartphone Trainer name Date.

Similar presentations


Presentation on theme: "V0.01 © 2009 Research In Motion Limited Introduction to Java Application Development for the BlackBerry Smartphone Trainer name Date."— Presentation transcript:

1 v0.01 © 2009 Research In Motion Limited Introduction to Java Application Development for the BlackBerry Smartphone Trainer name Date

2 © 2009 Research In Motion Limited Revision history Document versionDateUpdated byDescription of revision.01Brian WhiteInitial content creation

3 In this course, you will cover the following topics: –Introduction to Java® application development for mobile devices –Understanding Java APIs for mobile devices –Developing a user interface for mobile devices –Push technology for Java applications –Introduction to threading and background processing –Network communication for mobile devices –Testing and debugging an application

4 Testing and debugging an application Objectives At the end of this module, you should be able to the following: –Explain the importance of preverifying applications –Identify the available test tools –Explain the available debugging tools in BlackBerry® JDE Plug-in for Eclipse® –Explain gargage collection, memory leaks, deadlocks and their importance –Explain the Event Log

5 © 2009 Research In Motion Limited Preverifying applications

6 © 2009 Research In Motion Limited Preverifying applications –Reduces the amount of processing that the BlackBerry® smartphone must perform when you install your BlackBerry Java Application. –Allows you to partially verify classes before transferring an application to the BlackBerry smartphone. –Launched manually with the following command preverify.exe [-d] output -classpath directory input; directory –Performed automatically in IDE

7 Methods for testing applications

8 You can test BlackBerry applications with the following methods: –On the BlackBerry Smartphone Simulator –On a BlackBerry smartphone

9 Methods for testing applications BlackBerry Smartphone Simulator: –Enables you to run BlackBerry smartphone applications on your computer –Includes the applications typically available on BlackBerry smartphones –Is an accurate environment for testing how applications function on a Blackberry smartphone

10 Methods for testing applications BlackBerry smartphone: –Is the most accurate test for how applications will run –Provides better view of networking functionality –Compatible with the BlackBerry® Integrated Development Environment, and use the debugging tool

11 Debugging tools available in BlackBerry JDE Plug-in for Eclipse

12 The BlackBerry JDE Plug-in for Eclipse has the following interfaces for troubleshooting your application: –Console window –Variables and debugging window –BlackBerry Memory Statistics view –BlackBerry Objects view –BlackBerry Profiler View

13 Debugging tools available in BlackBerry JDE Plug-in for Eclipse Console window: –Displays messages from the BlackBerry® Java® Virtual Machine –Displays custom error messages

14 Debugging tools available in BlackBerry JDE Plug-in for Eclipse Variables and debugging window: –Displays local variables when the application hits a breakpoint and stops –Allows you to resume, step into, and step over the code –displays the step-by-step functioning of the application –Displays the running threads

15 Debugging tools available in BlackBerry JDE Plug-in for Eclipse Variable window example:

16 Debugging tools available in BlackBerry JDE Plug-in for Eclipse Debug window example:

17 Debugging tools available in BlackBerry JDE Plug-in for Eclipse BlackBerry Memory Statistics view: –Displays the amount of RAM used at a breakpoint –Allows you to save and compare memory statistics at breakpoints RAM random access memory

18 Debugging tools available in BlackBerry JDE Plug-in for Eclipse BlackBerry Objects View: –Displays all objects from all running applications –Use the Snapshot option to compare the objects between two breakpoints –Use the filter to limit the displayed objects

19 Debugging tools available in BlackBerry JDE Plug-in for Eclipse Blackberry Profiler View: –The main view displays information about application states –The summary view displays percentage spent in idle, code execution and garbage collection stages –The Method view displays a detailed view of all running packages

20 Debugging tools available in BlackBerry JDE Plug-in for Eclipse BlackBerry Profiler View (Method view) example:

21 Garbage collection, memory leaks and deadlocks

22 Garbage collection: –The BlackBerry smartphone implements garbage collection to periodically free its memory and resources. –All the objects that do not have a reference remain in memory until a garbage collection runs and frees that memory. –No other application runs while garbage collection is running.

23 Garbage collection, memory leaks and deadlocks Garbage collection: Garbage collection typeTime required RAM only.5 seconds Flash + RAM (full)1 second Persistent10 seconds Emergency20 + seconds Thorough20 to 30 seconds

24 Garbage collection, memory leaks and deadlocks Memory leaks: –Created when a reference to an unneeded object is maintained –Usually found in the following data structure local variables runtime store listeners

25 Garbage collection, memory leaks and deadlocks Memory leaks: –The following symptoms suggest memory leaks Hourglass appears often as the device is trying to do garbage collection Email messages start being deleted –To view the free object handles, go to Options/Status on your BlackBerry smartphone. The File Free number appears. If the number is low, it can indicate a memory leak.

26 Garbage collection, memory leaks and deadlocks Deadlocks: –Occur when two or more threads are waiting for each other, and therefore the application becomes blocked. –Use the Interrupt debugger on potential deadlock feature on the BlackBerry Smartphone Simulator to detect deadlocks.

27 Event Log

28 –View the log of system events –Write to the event log using the available APIs –Access the event log on the BlackBerry smarthphone or copy it to your computer using the application called Javaloader –Open the event log from the the Home screen by holding down the Alt key, and typing lglg

29 Event Log Example Event Log:

30 Event Log Select an item in the event log to see additional details about the event.

31 Summary –When you preverify your classes, you reduce the amount of processing that the BlackBerry® Smartphone must perform when you install your BlackBerry Java application. –You can test applications in the BlackBerry Smartphone Simulator or on the BlackBerry Smartphone. –The BlackBerry Smartphone Simulator runs the same Java code as the Blackberry smartphone, so the BlackBerry Smartphone Simulator provides an accurate environment for testing how applications functions on a Blackberry smartphone. You can test on a BlackBerry Smartphone to better verify functions such as network connections. –BlackBerry JDE Plug-in for Eclipse allows you to debug an application with the following interfaces: Console window, which displays the output from the virtual machine, as well as the message from your own application. Variable and debug window, which displays the values of all local variables at the breakpoint BlackBerry Memory Statistics View, which displays amounts of RAM used by an application BlackBerry Objects View, which displays all objects, from running applications to view memory usage BlackBerry Profiler View, which displays information about application states –Garbage collection periodically frees memory and resources. All the objects that do not have a reference remain in memory until a garbage collection runs and frees that memory. –Memory leaks are created when a reference to an unneeded object is maintained. Even if you design code that deletes these references, a reference remains in the system that still prevents that object from being deleted. –Deadlocks occur when two or more threads are waiting for each other, and therefore the application becomes blocked. –The Event Log is a log of all system events. You can write to the event log using available APIs.

32 © 2009 Research In Motion Limited

33 Legal Disclaimer The following trademarks and/or registered trademarks of Research In Motion are referred to in this presentation: –BlackBerry® –Research In Motion® (only include if it appears in the webinar/presentation) –RIM® (only include if it appears in the webinar/presentation) The following BlackBerry products are referred to in this presentation: (include all items from the official BlackBerry products list that appear in the webinar/presentation) –BlackBerry® Internet Service –BlackBerry® Enterprise Solution –BlackBerry® Enterprise Server –BlackBerry® Pearl™ 8100 smartphone –BlackBerry® Curve™ 8300 smartphone The following third-party trademarks are referred to in this presentation: (include all third-party products that appear in the webinar/presentation) –Microsoft® Excel® –Microsoft® SQL Server® Please remove any products not mentioned in this presentation and add all mentioned products before completing this presentation. Also, remove any remaining red text. © 2009 Research In Motion Limited

34 Legal Disclaimer © 2009 Research In Motion Limited. All rights reserved. BlackBerry®, RIM®, Research In Motion®, SurePress™ SureType® and related trademarks, names and logos are the property of Research In Motion Limited and are registered and/or used in the U.S. and countries around the world. All other trademarks are the property of their respective owners. This documentation is provided "AS IS" and without condition, endorsement, guarantee, representation or warranty, or liability of any kind by Research In Motion Limited and its affiliated companies, all of which are expressly disclaimed to the maximum extent permitted by applicable law in your jurisdiction.

35 © 2009 Research In Motion Limited Revision history Document versionDateUpdated byDescription of revision


Download ppt "V0.01 © 2009 Research In Motion Limited Introduction to Java Application Development for the BlackBerry Smartphone Trainer name Date."

Similar presentations


Ads by Google