I noticed many time this Warning in my logs and I want to know how to get rid of it.
I understand it comes from this where the AllCapsTransformationMethod has a disable state.
setLengthChangesAllowed(boolean allowLengthChanges)
? Thanks.
PS : if you know better tags, I will add them.
The method setLengthChangesAllowed(boolean)
will be called by TextView
in setTransformationMethod(TransformationMethod)
. The value of the boolean flag is evaluated like this (I only checked API 18): mAllowTransformationLengthChange = !isTextSelectable() && !(mText instanceof Editable);
.
So if the text is selectable or editable (for example your component is an EditText
), the AllCapsTransformationMethod
will be ignored and you will get the warning message W/AllCapsTransformationMethod: Caller did not enable length changes; not transforming text
.
To hopefully answer your questions:
android:textAllCaps
to true for editable/selectable text - that should get rid of the warning. You cannot really call setLengthChangesAllowed(boolean)
unless you use reflection voodoo which might work or not, break things and make your code harder to maintain. AllCapsTransformationMethod
in memory which ocasionally produces that warning but otherwise does nothing. The performance impact should be minimal, tending towards zero. It's probably best to manually set your editable/selectable text to caps instead of applying the textAllCaps
attribute with no effect.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With