I am looking for a solution to disable the long press edit menu(copy/paste) and also the double-tap select-all function for an edittext box. I have read through a few solutions on here to this issue in similar fashion, however, need to go a step further.
For this app I have a requirement to prevent the user from using the copy/paste functions on my app and need a way to disable this functionality that will work on 2.3 API as well as when used on a newer tablet. I am testing with a NexusOne phone device and a Galaxy Tablet. (minSDK is 8, target is 10)
Currently I am using this (as example): edittextPassword.setLongClickable(false); -disables the popup edit menu, Great!
This method does work on the phone device to prevent the edit menu popup. On the tablet, this is also disabled from the long-press action. The tablet however has newer functionality of a double-tap which will select-all text and open the edit menu. Is there a way for an older API to cancel/trap/disable a newer API feature or prevent the double-tap gesture?
Update: Using a combination of setLongClickable(false) and setOnTouchListener connected to a GestureDetector (thank you Nikola for suggestion) I am able to trap/cancel the double click and long click edit menus from opening.
The next part to figure out is this ... on Samsung phones (Galaxy S, not sure about other devices at the moment), when you tap into a field, you get a cursor and a floating cursor pointer button (proper name??). Clicking on this pointer button is another method to open the edit menu. Anyone know how to disable this one? My only workaround left is to clear the Clipboard on BeforeTextChanges and AfterTextChanges using a TextWatcher. This ensures that even if you get to the Copy/Paste menu, the clipboard is cleared and there is nothing to paste.