0

I want to disable copy paste in all of my android page and no one cant long touch on my application .

android:longClickable="false" it dosent work.

W4R10CK
  • 5,502
  • 2
  • 19
  • 30
Pooya Jafari
  • 3
  • 2
  • 4
  • Look at: http://stackoverflow.com/questions/26175041/android-how-to-totally-disable-copy-and-paste-function-in-edittext – MatBos Jan 28 '17 at 15:49
  • 3
    Possible duplicate of [Android: How to TOTALLY disable copy and paste function in Edittext](http://stackoverflow.com/questions/26175041/android-how-to-totally-disable-copy-and-paste-function-in-edittext) – TDG Jan 28 '17 at 15:59

2 Answers2

1

This worked for me:

In xml, disable the long-click in the EditText: android:longClickable="false".

Also, you have to return false from these methods:

mEditEext.setCustomSelectionActionModeCallback(new ActionMode.Callback() {

        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        public void onDestroyActionMode(ActionMode mode) {                  
        }

        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return false;
        }
    });
P R
  • 105
  • 9
0

I think it will work fine. User can not able to copy your page to another app.

//Inside onResume and onDestroy
ClipboardManager clipboardManager = (ClipboardManager)     context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboardManager.setText("");

Here, It will restrict for background process "Secondary app". But you can copy and paste it only inside your app.

Gowtham Subramaniam
  • 3,358
  • 2
  • 19
  • 31