Long press Android
<p>I have problems with detecting long press in my custom view.</p>

<p>Here's the code related to this issue</p>

<pre><code>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);
};
</code></pre>

<p>This code detects every single (short) click as long press.</p>

<p>When I put this code in class inherited from Activity, it works.</p>

<p>So why it isn't working in custom View ?</p>
