You Are Here:

Community: Wiki

This page was last modified on 29 September 2009, at 17:36.

How to use TapDetectionHelper in Java ME

From Forum Nokia Wiki

Reviewer Approved   

Contents

Overview

When touch screen is tapped with finger it may generate lots of unnecessary noice (drag events) and also "pointer up" event might easily end up being too far away from "pointer down" coordinates. Many applications rely on "pointer up" and "pointer down" to occure within certain area in order to launch some functionality(e.g. selecting small links in Internet Browser). A new feature called TapDetectionHelper offers help for detecting taps in Canvas based Java applications.

Functionality

  • Coordinates are saved whenever "pointer down" event occurs
  • Drag events are suppressed if they occure within predefined rect (and time) around the "pointer down" coordinates.
    • default rectangle size is about 7mmx7mm
    • default timeout is 500ms
  • If finger is dragged outside of the rect, drag events will be passed normally to the MIDlet
  • If timeout passes, drag events will be passed normally to the MIDlet
  • If "pointer up" event occurs within rect/timeout, the "pointer up" coordinates will be set the same as "pointer down" coordinates
  • The amount of the coming drag events might be unnecessarily high. By default the amount of these events are limited by using "drag event frequency limiter". The time between the events is not shorter than 50ms.
    • By using JAD parameter setting Nokia-MIDlet-Tap-Detection-Options:0,0 MIDlet is able to get all the drag events generated by platform with higher frequency (no "drag event frequency limiter" is used).
    • Note: the "drag event frequency limiter" is not available in the first Nokia N97 software versions (sw 10.x.x)


As a result finger touch events on small areas are detected more reliably. Note, that using TapDetectionHelper might make usability worse in painting or drawing applications. For such applications it is possible to disable the feature, as shown below.

Usage

It is possible to use JAD attribute "Nokia-MIDlet-Tap-Detection-Options" to alter the predefined suppressor values (i.e. 200twips, 500ms). Twip value is the distance from "pointer down" coordinates and rectangle can be calculated by multiplying this value with two. (1 twip = 1/1440 of an inch)

Examples

Nokia-MIDlet-Tap-Detection-Options:0,0 <- Disable the feature, All drag events will be passed to the MIDlet. No up-event coordinate switching will be done. 
Nokia-MIDlet-Tap-Detection-Options:200,500 <- Same as default values. Rectangle size 400x400 twips (about 7mmx7mm). Timeout 500ms.
Nokia-MIDlet-Tap-Detection-Options:100,250 <- Rectangle size 200x200 twips. Timeout 250ms.

Image:OperaMini_bbccom_mod.png

Picture 1. Link selection situation in Opera Mini Browser. The screen has been touched on the red dot. Rectange illustrates the safe area within where all drag events will be suppressed for 500ms. If "pointer up" occurs within red rectange and within 500ms, it's coordinates will be set the same as "pointer down" coordinates. As a result accurate tapping/selecting small link has been made easier by TapDetectionHelper.

Image:SuppressorRect.png

Picture 2. Default rectangle dimensions and JAD parameter twip usage.


See also

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTalkE3aE4cargeE5fscreenE5fsaverX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ