0

I am using to show the list of phonecontacts and trying to click an item and when double tap is done the earlier clickeditem should be taken into account and make a call . Similar to imitate when talkback accessibility is enabled.

But whenever i am trying to double tap on the listitem , instead onItemClick is being called. But when doing double tap on the edges of the list item , doubleTap event is captured.

Could anyone please help what might be the issue?

And also help how to do : by default the first item of the list should be selected and speakout the first contact and when user scrolls read the next contact and highlight that listitem .

bharath
  • 89
  • 2
  • 10

1 Answers1

0

Reproduced from https://stackoverflow.com/a/6290044:

public class MyView extends View {

  GestureDetector gestureDetector;

  public MyView(Context context, AttributeSet attrs) {
    super(context, attrs);
    // creating new gesture detector
    gestureDetector = new GestureDetector(context, new GestureListener());
  }

  // skipping measure calculation and drawing

  // delegate the event to the gesture detector
  @Override
  public boolean onTouchEvent(MotionEvent e) {
    return gestureDetector.onTouchEvent(e);
  }


  private class GestureListener extends GestureDetector.SimpleOnGestureListener {

    @Override
    public boolean onDown(MotionEvent e) {
      return true;
    }
    // event when double tap occurs
    @Override
    public boolean onDoubleTap(MotionEvent e) {
      float x = e.getX();
      float y = e.getY();

      Log.d("Double Tap", "Tapped at: (" + x + "," + y + ")");

      return true;
    }
  }
}
Community
  • 1
  • 1
5ELuqLbb85Hk
  • 161
  • 1
  • 9
  • Hi implemented the onDoubleTap() but the control is coming to this method only when i doubletap on the edges(either right or left edges of the screen) of the list item but when i am doubletapping on the listitem it is taking that event as itemselect event and not going to onDoubleTap(). – bharath Mar 08 '14 at 21:58