0

I want to disable EditText contextmenuitem "Clipboard" to open a popup view. Whenever I long press edittext in my app contextmenuitem appears as "Paste, Clipboard". I want to retain the functionality of "Paste" option but "Clipboard" should not work. I have Made a Custom EditText class where I have callbacks for actions such as cut, paste,copy with respect to their Id. But I am unable to diable "Clipboard" function.

override fun onTextContextMenuItem(id: Int): Boolean {
    // Do your thing:
    val consumed = super.onTextContextMenuItem(id)
    when (id) {
        R.id.cut -> onCut()
        R.id.copy -> onCopy()
        R.id.paste, R.id.pasteAsPlainText -> {
            onPaste()
        }
        android.R.id.keyboardView->{}
        R.id.accessibilityActionContextClick->{}
        R.id.accessibilityActionHideTooltip->{}
        R.id.accessibilityActionImeEnter->{}

    }
    return consumed
}

Below picture shows the EditText optionsenter image description here

and this picture shows when I Click Clipboard option

enter image description here

Raza
  • 791
  • 7
  • 22

0 Answers0