[android-developers] Intercept/override context menu on EditText long-press?
I want to intercept an EditText long-press and do something with it other than present a contextual menu. Obviously, I cannot simply disable the GestureDetector's long press detection because I do in fact want to use the long press. By the time onCreateContextMenu() is called, it seems to be too late to prevent the contextual menu from occurring. Not calling super.onCreateContextMenu for example doesn't prevent it, nor does anything else I have tried...and onCreateContextMenu() is called before onLongPress(), so the answer to my question can't be some behavior in onLongPress(). Should I be doing something in dispatchTouchEvent(), onDown(), or showPress() to accomplish this goal? Those seem to be the only methods that are called before onCreateContextMenu(). Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Intercept/override context menu on EditText long-press?
On Sun, Apr 24, 2011 at 5:54 PM, Keith Wiley kbwi...@gmail.com wrote: I want to intercept an EditText long-press and do something with it other than present a contextual menu. Please don't. Users will expect the standard EditText context menu to appear, so they can do silly things like edit the text. Android developers get ripped to shreds by users and the media for having zero UI discipline, breaking existing UI patterns and causing no two apps to work the same -- your proposal is a case in point. If your goal is for users to not edit the text, then don't use an EditText. If your goal is for users to edit the text, leave the context menu alone, and find some other way to trigger whatever it is that you are trying to do. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 3.0 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en