Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

Keeping a Close Eye on BlackBerry App Callbacks

Part of the BlackBerry Application Development For Dummies Cheat Sheet

Your BlackBerry application uses callbacks to allow the smartphone's OS to call into your application for specific operations. Your BlackBerry application itself likely employs callbacks to allow the threads it creates to inform the main process of your application that the thread has completed its job.

Here are a few things to keep in mind when dealing with callbacks:

  • Implement your BlackBerry application's callbacks as an interface, not a class. This allows you the flexibility to make any concrete class already in your application an object that can receive the message from the thread.

  • Provide both success and failure methods in your callback implementation. You should program as if something bad will happen so you'll be prepared when it does, such as a failure to reach a network service or a BlackBerry running low on memory unable to download a large file.

  • If your callback is going to modify what's on display or interact with the user, place the code to be executed within a Runnable object and pass that object into a call to UiApplication.invokeLater( Runnable r ).

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
BlackBerry Application Development For Dummies Cheat Sheet

Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.