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.
In MIDlets, tactile feedback is supported since Series 40 6th Edition FP1 and Java Runtime 1.3 for S60. Users can enable and disable tactile feedback from the device settings.
On Series 40 and Symbian devices, if enabled, tactile feedback works automatically with all high-level LCDUI components. On Symbian devices, tactile feedback also works automatically with all high-level eSWT components.
MIDlets cannot enable or disable tactile feedback for high-level UI components.
On Series 40 devices, if enabled, tactile feedback works automatically with all low-level LCDUI components. MIDlets cannot enable or disable tactile feedback for these components.
On Symbian devices, low-level LCDUI and
eSWT components do not automatically support tactile feedback. For
these components, 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 components.
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 Series 40 devices. So, even though you
cannot actually use this feature on Series 40 devices, you can compile
the MIDlet with the method calls in place. The stub implementation
is supported from Series 40 6th Edition FP1 onwards. Earlier Series
40 releases do not support the TactileFeedback
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 components:
Note: The following code snippets assume that you have already created the necessary UI components 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
components, since the directFeedback
method merely
triggers tactile feedback on the device, irrespective of what UI component
is selected.
If you want to provide area-based feedback, use the registerFeedbackArea
method.