Touch devices provide tactile feedback when the user interacts with the touch screen. Tactile feedback consists of small signs (audio, vibration) that accompany touch events. These signs provide immediate physical confirmation that a touch event has been registered. Tactile feedback thus enables a more responsive interaction experience by eliminating the passive feeling of touch UIs.
Tactile feedback is provided for all touch events. As a rule, tactile feedback is triggered every time the user interacts with the touch UI. For example, the device provides tactile feedback when the user touches a button and also when the user releases touch. When a slider is used, the device provides continuous tactile feedback. MIDlets provide tactile feedback in a manner similar to native applications.
Like audio, use tactile feedback carefully so as not to desensitize the user to the effect. The attention-grabbing quality of tactile feedback is maintained only as long as the feedback is not too frequent.
Tactile feedback is supported on Symbian devices since since Java Runtime 1.3 for S60. Users can enable and disable tactile feedback from the device settings.
On Symbian devices, if enabled, tactile feedback works automatically with all high-level LCDUI elements. On Symbian devices, tactile feedback also works automatically with all high-level eSWT elements.
MIDlets cannot enable or disable tactile feedback for high-level UI elements.
On Symbian devices,
low-level LCDUI and eSWT elements do not automatically support tactile
feedback. For these elements, you need to separately implement tactile
feedback by using the TactileFeedback
class of the Nokia UI API.
The device's native tactile feedback settings do not affect low-level
UI elements.
Note: The Series 40 platform provides a stub implementation
of the TactileFeedback
class. This means that you
can call the class methods in your MIDlet, but they provide no functionality
on a Series 40 device. So, even though you cannot actually use this
feature on a Series 40 device, you can compile the MIDlet with the
method calls in place. The stub implementation is supported since
Java Runtime 2.0.0 for Series 40. Earlier Series 40 releases do not
support the class in any form.
On a Symbian device, to
determine whether the device supports the TactileFeedback
class, use the com.nokia.mid.ui.tactilefeedback
system
property.
TactileFeedback
allows you to create
tactile feedback in two ways:
By directly generating tactile feedback in response to a specific touch action
By defining screen areas that provide tactile feedback automatically when touched
While predefined screen areas only provide tactile feedback
on touch down events (pointerPressed
in LCDUI and mouseDown
in eSWT), direct feedback allows you to fully
control what kind of user interaction triggers the feedback. However,
if feedback latency is an issue, use area-based feedback, since it
guarantees minimum latency.
To provide tactile feedback for low-level LCDUI and eSWT elements:
Note: The following code snippets assume that you have already created the necessary UI elements and defined touch event handlers for them.
Create a TactileFeedback
object instance:
TactileFeedback tactileFeedback = new TactileFeedback();
Check whether the device supports tactile feedback:
if (tactileFeedback.isTouchFeedbackSupported()) { // If tactile feedback is supported // ... } else { // If tactile feedback is not supported // ... }
Implement tactile feedback in the touch event handlers:
If you want to provide direct feedback, use the directFeedback
method.
Tip: You can also define direct feedback for high-level UI
elements, since the directFeedback
method merely
triggers tactile feedback on the device, irrespective of what UI element
is selected.
If you want to provide area-based feedback, use the registerFeedbackArea
method.