Smartphone Development
  Home arrow Smartphone Development arrow Page 3 - Debugging Your BlackBerry Applications
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
SMARTPHONE DEVELOPMENT

Debugging Your BlackBerry Applications
By: Joe eitel
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2009-06-17


    Table of Contents:
  • Debugging Your BlackBerry Applications
  • Eclipse
  • Eclipse’s Tools for Debugging

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Debugging Your BlackBerry Applications - Eclipse’s Tools for Debugging
    ( Page 3 of 3 )

    Once you have your app up and running on Eclipse, you will need to click Run/Debug, which can be reached by pushing the F11 button. It should be pointed out that the run/debug command usually requires the simulator to take a longer time while launching, but on the bright side, it provides developers with a number of different tools they can utilize while troubleshooting on their app. Also, Eclipse allows users to rearrange their workspace in a number of different ways, so some of the buttons or tools we discuss here may not be immediately apparent, depending on your layout. Typically, at the top of your screen you will be able to see where the Java button is; next to it should be a debug button that enables users to switch their view to the debug screen.

    The typical debug layout features a debug tab, which shows your running threads. If the simulator is not currently running, most of the windows available in the layout will be empty. Below the layout is where the source code is located, which is also where you can add breakpoints either before or during the simulation. When the simulator hits the breakpoint you’ve inserted, it will stop execution of your application. Below the source code window is typically where the console window will be located. The output from the simulator, as well as the messages from your own app, will be shown there.

    The console window can give developers a wide array of very useful messages from the JVM, but it also enables them to write their own custom messages. For example, adding the message “System.err.println(x)” will ensure that the x inserted will be displayed in the console window. So how is this helpful? Using what is commonly referred to as “try-catch blocks” enables developers to catch exceptions and print as much information as they need. This is particularly beneficial during the debugging process, as it allows users to print out a custom error number, exception name, and stack.

    The variables and debugging windows allow developers to view the values of the local variables after the app has hit the breakpoint and stopped. The variables window, of course, will feature the values of every local variable at the breakpoint. Usually, on the upper right hand corner of the debug window, there will be control icons. These icons enable users to resume their app or step into or over their code. This feature will prove to be particularly useful, as it enables users to see every step of what’s going on with their application. The debug window also features areas where users can view running threads, pause and resume their app manually, and set up as well as apply filters.

    Developers can explore various views by clicking on window/show view/other/expand BlackBerry. Some of the viewpoints include memory statistics view, objects view, and profiler view. To use memory statistics view, a user must set up two breakpoints, and when the app stops at the first breakpoint, pushing refresh will enable them to save the data. Essentially, this allows a developer to have a snapshot of the app that they can reference later. When the app stops at the next breakpoint, the BlackBerry memory statistics view should be refreshed again. Pressing the compare button afterward will enable the system to show all of the changes.

    A similar process takes place when using the objects view option. Wait until the app hits a breakpoint, refresh the BlackBerry objects view when it does, and voila -- the objects view will show you all objects. Keep in mind that it won’t just display objects from your app, but it will also include objects from all running apps. Saving this data will enable you to use the snapshot to compare objects between the two breaking points, which can help to find memory leaks.

    Lastly, the profiler view is intended to illustrate where your app spends its time. The summary view will display the percentage of time the application spends in idle, code execution, and garbage collection stages.

    Now that you’re familiar with the tools offered by Eclipse, debugging should be just about as easy as writing apps for BlackBerry devices.



     
     
    >>> More Smartphone Development Articles          >>> More By Joe eitel
     

       

    SMARTPHONE DEVELOPMENT ARTICLES

    - Getting Started with Rich Media
    - How to Incorporate Location into Your BlackB...
    - Building Business Apps with the BlackBerry B...
    - The BlackBerry Java Development Environment ...
    - Advanced Java Programming for BlackBerry Sma...
    - Learning Java Application Development
    - Programming Intuitively with the BlackBerry ...
    - Simulating a BlackBerry Device
    - Data Types and Data Retrieval with BlackBerry
    - Debugging Your BlackBerry Applications
    - What You Need to Know to Get Started as a Bl...
    - Comparing RIM and JAVA ME APIs
    - Advanced BlackBerry Browser Development
    - Introducing the BlackBerry Push API
    - Developing the BlackBerry Browser




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek