190 likes | 418 Views
BlackBerry API for UI Applications. BlackBerry API for UI. What is the purpose of a GUI in an application? Relationship between app and user Provide information in a user-friendly way Easy to read Intuitive Familiar. BlackBerry API for UI. Which UI API to use? BlackBerry Java App:
E N D
BlackBerry API for UI • What is the purpose of a GUI in an application? • Relationship between app and user • Provide information in a user-friendly way • Easy to read • Intuitive • Familiar Wendi Jollymore, ACES
BlackBerry API for UI • Which UI API to use? • BlackBerry Java App: • BlackBerry Java UI API • Always extends UiApplication and starts with main() • And probably MIDP API and CLDC API • MIDlet • An app that uses the MIDP UI API • Can run on any device that uses Java ME Wendi Jollymore, ACES
BlackBerry UI API Advantages • Provide more functionality for BB devices than just MIDP API • Can run background threads after app closes • Can start automatically in the background when device turns on • Can use IPC (Inter-Process Communications) APIs to send and rec’v information • Can access trackball and trackwheel events • Can access touch screen events • Can access and use accelerometer data • Can integrate with other BB apps • Can change home screen icon for your app Wendi Jollymore, ACES
BlackBerry UI API Disadvantages • BlackBerry APIs can only be used on a BlackBerry device. Wendi Jollymore, ACES
UI Guidelines • Consider limitations of mobile devices: • Small screen size, limited # of characters • Slower processor • Wireless network – slower, longer delays • Small amount of memory • Short battery life • Can only display one screen at a time • Users expect smaller amounts of information quickly • BlackBerry UI was designed with this in mind Wendi Jollymore, ACES
UI Guidelines • Be consistent • Use or extend existing components • Allows you to inherit default behaviour • Follow standard navigation model • Actions are the same for all apps • Support and extend user tasks • Help user perform tasks easily e.g. auto-detect location if your app is location-based • BlackBerry users are familiar with how BlackBerry UIs work! Wendi Jollymore, ACES
UI Guidelines • Focus on user’s task • Only display data/components that are relevant to the task at hand • Make selection of data simple • Make menu items relevant and in context • E.g. for an app that searches for hotels, a “search” or “start over” item would be relevant, but a “delete” item might not be Wendi Jollymore, ACES
UI Guidelines • Minimize clicks needed to complete a task • Allow for “Undo” • It’s easier on a small screen to click the wrong thing by accident • Design your display for the small screen Wendi Jollymore, ACES
UI Input and Action Triggers • Devices contain standard input methods: • Keyboard • Trackball or track pad • Track wheel • Escape key • Touch screen • Standard behavior: • Clicking trackball, track wheel, track pad or touch screen invokes a menu item or application icon • Escape cancels current operation or returns to previous screen • See more in Section 2 of the UI & Navigation Development Guide Wendi Jollymore, ACES
UI Components • Three main components that make up a UI: • Screen • Display, layout • Menu • Standard behavior when user clicks or Escapes • Managers • Arranges components in a specific way • Like Java SE layout mangers • Fields • Standard UI elements like buttons, labels, text fields, radio buttons, check boxes, etc. Wendi Jollymore, ACES
UI Components • Screens contain Managers, Managers contain Fields Screen Object Manager Object Component Wendi Jollymore, ACES
Screen Class • net.rim.device.api.ui.Screen • Starting point for the GUI • Only one screen can be displayed at a time • Screen display stack • Screens are displayed by pushing and popping them on/off the display stack • Only the screen on top of the stack is seen • A screen can exist only once in the stack • net.rim.device.api.ui.container • Common subclasses of Screen class • Check this out in the api docs Wendi Jollymore, ACES
MainScreen Class • A child of Screen (via FullScreen) • Contains standard UI components: • Default screen title • Scrollable VerticalFieldManager • Default menu with Close item • Default action for Close menu item and escape key • Most BlackBerry apps’ screens are extended from MainScreen Wendi Jollymore, ACES
Manager Class • net.rim.device.api.ui.Manager • Manages the layout of the components of your UI • And how the components react when laid out near each other • Just like layout mangers in Java SE • Every screen object contains at least one manager • net.rim.device.api.ui.container • Some common sub classes of Manager Wendi Jollymore, ACES
Manager Examples • VerticalFieldManager • Lays out fields in a single column • Can be constructed with horizontal or vertical scroll • Manager.HORIZONTAL_SCROLL or Manager.VERTICAL_SCROLL • FlowFieldManager • Like the Java SE FlowLayout • Lays out components horizontally and vertically like words on a page • Wraps to next line Wendi Jollymore, ACES
Field Class • net.rim.device.api.ui.Field • A rectangular region that displays output to a user • Can also accept input • net.rim.device.api.ui.component • Contains pre-made component classes • Look this up in the api docs Wendi Jollymore, ACES
Field Examples • LabelField • A simple label with text • Text Field • A simple text field for inputting text • EditField • Simple text field that has its own label • RichTextField • Label field with formatting • ListField, ChoiceField, • RadioButtonField, CheckBoxField • DateField, ButtonField Wendi Jollymore, ACES
Exercise • See the Exercise section in the notes Wendi Jollymore, ACES