Long press Android
===

I have problems with detecting long press in my custom view.

Here's the code related to this issue

    final GestureDetector gestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
        public void onLongPress(MotionEvent e) {
            Log.e("dbg_msg", "onLongPress");
        }
    });

    public boolean onTouchEvent(MotionEvent event) {
        return gestureDetector.onTouchEvent(event);
    };

This code detects every single (short) click as long press.

When I put this code in class inherited from Activity, it works.

So why it isn't working in custom View ?