I know that limiting the text length of EditText can be done using the maxLength attribute in xml or using InputFilter using the below approaches
Using xml
android:maxLength="10"
Using InputFilter
myEditText.filters = arrayOf(InputFilter.LengthFilter(10))
But I want to enable user to type as many characters as they want while limiting the number of characters that can be pasted into the EditText using clipboard. How can I achieve this? Thanks!