下面的代码在 Kotlin/Android 中崩溃,堆栈跟踪位于底部。它是从Java/Android转换而来的,没有这样的问题。还提供了原始 Java 代码。当我尝试向密码字段添加字符时发生崩溃。编辑现有字符效果很好。
我对此有两个问题:
导致 Android Paint 崩溃的 Kotlin 代码
mPwd!!.transformationMethod = object : PasswordTransformationMethod() {
override fun getTransformation(source: CharSequence, view: View): CharSequence {
return PasswordCharSequence(source)
}
internal inner class PasswordCharSequence(private val source: CharSequence)// Store char sequence
: CharSequence {
val mSource = source
public override val length = mSource.length
init {
App.d(TAG, "SOURCE " + mSource + " " + length)
}
override fun get(index: Int): …Run Code Online (Sandbox Code Playgroud)