The basic interface for displaying anything to the BlackBerry device’s screen is the net.rim.device.api.ui.Graphics class. It’s used under the hood by pretty much all elements of the BlackBerry user interface,and it gives you the tools to do anything you’ve seen in any BlackBerry application’s user interface. If you’re going to be doing any kind of user interface work with BlackBerry applications, you should get very familiar with the Graphics class. Each instance of Graphics is associated either with a Bitmap object or with a display (basically, a BlackBerry device’s physical screen).For this book, we’ll only focus on a Graphics object associated with a display.
Using the paint method
All fields (and managers and screens) get access to the Graphics object associated with the current display through the paint method. This method is called whenever the BlackBerry device determines that the section of the display containing the Field needs repainting.An important thing to bear in mind is that the same instance of the Graphics class is used by all managers and fields on a screen, and this instance is passed by the screen through its managers to the fields. This may seem a minor point, but it’s important to keep in mind, as it’ll help in determining exactly why your application is drawing to the screen in a certain way. For example, setting the color on the Graphics object will affect the color of components drawn after it, unless they explicitly set their own colors. Because it’s so important to understand how the UI is displayed by the BlackBerry platform, we’ll take time for a brief discussion here before getting to more concrete examples.
Understanding How the BlackBerry Screen Is Drawn
At a high level, things happen in two stages. First comes the layout stage, where layout and sublayout methods are called and all the fields are positioned and sized on the screen. Second is the paint stage, where paint methods are called and the fields actually draw to the display.
Laying Out the Screen
Layout involves positioning and sizing all the managers and controls on the screen. It starts with the screen itself and works down through all the nested managers and fields as follows:
Painting to the Screen
The Painting stage is where pixels are actually drawn to the screen. In the same sequence as the layout stage, the screen, managers and fields are all asked to paint themselves:
Another important thing to keep in mind is that layout happens rarely generally when a screen is constructed or when fields are added or removed—while paint happens frequently. This means that you should be very concerned about the speed of your paint methods; slow paint methods will slow down your user interface and negatively affect your application’s user experience. You should remember, in a nutshell, that
Now that we’ve covered the framework, it’s time to fill in the details by actually implementing some custom fields, managers, and screens.Along the way, we’ll use a lot of the methods in the Graphics class and explore those as we encounter them.
BLACKBERRY Related Interview Questions
|J2ME Interview Questions||BLACKBERRY Interview Questions|
|Android Interview Questions||Retail Interview Questions|
|Telecommunication Project Management Interview Questions||Mobile Testing Interview Questions|
|Telemarketing Interview Questions||Mobile Application Testing Interview Questions|
|Mobile Marketing Interview Questions||Telecom Billing Interview Questions|
|Mobile Application Architect Interview Questions|
Setting The Stage
What Makes A Blackberry Application?
User Interface Basics
Beyond The Basics Of User Interfaces
Hello Out There! Making A Network-enabled Application
Where Am I? Using Location-based Services
Getting Your App Out There: Packaging And Publishing
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.