Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Programmatically determine type of keyboard

by Retired ‎02-16-2010 09:16 AM - edited ‎09-16-2010 02:57 PM (869 Views)

Summary

 

This article applies to the following:

  • BlackBerry® smartphone
  • BlackBerry Device Software 4.1 or later

Details

 

A common request from developers who would like to write an application that will work across a variety of BlackBerry smartphones is the ability to determine the type of keyboard being used by the BlackBerry smartphone. The following two types of keyboards can be found on BlackBerry smartphones:

  • Full QWERTY keyboards (e.g. found on the BlackBerry 8800 smartphone)
  • SureType® keyboard in a QWERTY-style layout (e.g. found on the BlackBerry Pearl™ 8100 smartphone)

Determining which keyboard exists on the BlackBerry smartphone can be done via the net.rim.device.api.ui.Keypad.getHardwareLayout() method as outlined below.

 

 

If( Keypad.getHardwareLayout() == Keypad.HW_LAYOUT_32 ) {
      // Using an 8700/8800 type BlackBerry smartphone
} else if( Keypad.getHardwareLayout() == Keypad.HW_LAYOUT_REDUCED_24 ) {
      // Using a BlackBerry Pearl smartphone
} else {
      // Using a Legacy keyboard (reduced or full)
}

 

This mechanism can be used to appropriately detect the keyboard and modify the behaviour of hotkeys and other keyboard specific features within your application.

Contributors
Users Online
Currently online: 35 members 592 guests
Please welcome our newest community members: