Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid cut/copy/paste in smart phone after rotation port to land on Android4.X?

I am working on to avoid cut/copy/paste in smart phone (for tablet its fine). Its fine in port mode but coming in land mode EditText shows a Button Next. after selecting the text, next button converts into Edit Button which has copy,cut and paste option.

So is there any way to disable cut/copy after rotation when edit button appears.

i am following this link. How to disable copy/paste from/to EditText

This image with out text select

After select

like image 324
Monty Avatar asked Dec 20 '12 09:12

Monty


People also ask

How do you stop copy and paste on Android?

I am able to disable copy-and-paste functionality with the following: textField. setCustomSelectionActionModeCallback(new ActionMode.

How do I control paste on my phone?

There's button on the bottom left corner of the keyboard from where you can swipe to a/x/c/v to select all/cut/copy/paste respectively.

How do you paste in plain text on Android?

Tap and hold in the space where you'd like to paste the text. Tap Paste in the menu that appears. You can alternatively choose to "Paste as plain text."


2 Answers

I think you can use this:

http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions

With the flag:

flagNoAccessoryAction

Used in conjunction with a custom action, this indicates that the action should not be available as an accessory button when the input method is full-screen. Note that by setting this flag, there can be cases where the action is simply never available to the user. Setting this generally means that you think showing text being edited is more important than the action you have supplied. Corresponds to IME_FLAG_NO_ACCESSORY_ACTION.

like image 56
neteinstein Avatar answered Sep 28 '22 11:09

neteinstein


I would insist you to disable the long click on the EditText as that Edit button appears when you long press on the selected text in the EditText.

et_text.setLongClickable(false);

Also, you can clear the ClipboardManager, so that if you already have something that is already copied to ClipBoard will be cleared using,

ClipboardManager manager = (ClipboardManager) 
                                 getSystemService(Context.CLIPBOARD_SERVICE);
manager.setText("");
like image 28
Lalit Poptani Avatar answered Sep 28 '22 11:09

Lalit Poptani