Android 2.1 fling gesture captured on textview but still a contextmenu opens

Posted by hermo on Stack Overflow See other posts from Stack Overflow or by hermo
Published on 2010-05-09T17:01:14Z Indexed on 2010/05/09 17:08 UTC
Read the original article Hit count: 341

The following problem seems unique to 2.1, happens both on an emulator and on a nexus. The same example works fine on other platforms I've tested (1.5, 1.6 and 2.0 emulators).

I've added created gestureListener as described in this post. The difference is that I've added the listener on a TextView which also has a contextMenu registered, i.e. sth like the following:

 onCreate(...) {
     ...
     // Layout contains a large TextView on which I want to add a context menu
     tv = findViewById(R.id.text_view);
     tv.registerForContextMenu(this);

     // create the gestureListener according above mentioned post.
     gestureListener = ...
     // set the listener on the text-view
     tv.setOnTouchListener(gestureListener);
     ...
}

When testing it, the correct gesture is recognized alright, but every other time it also causes the context menu to be opened. As the same example is working on non 2.1 platforms, I've got a feeling it is not my code that is the problem...

Thankful for any suggestions.

© Stack Overflow or respective owner

Related posts about android

Related posts about gesture