EditText; Do not allow copy / paste from one to another

I have two editing texts defined in the layout. Both of them are intended for the email address. After the user enters the first field, I want to force the user to enter the same email address again without performing the copy operation.

+3
source share
2 answers

Did not check this, but I think you could just override the OnLongClick listener (for each of your EditTexts) so that it does not display the context menu. Therefore, they will not be able to copy and paste.

 OnLongClickListener mOnLongClickListener = new OnLongClickListener() {

    @Override
    public boolean onLongClick(View v) {
        //since nothing is in here, nothing will happen.  

        return true;
    }
};
+4
source

You can set the following property in the textView properties (xml file):

Android :. LongClickable = "false"

this will avoid the longclick event in your text element.

+1
source

All Articles