简体   繁体   English

进入另一个 class kotlin 时如何重新初始化视图

[英]How to reInitialized view when going into another class kotlin

Im getting this error我收到这个错误

     kotlin.UninitializedPropertyAccessException: lateinit property recyclerView has not been initialized,

and i wonder if its possible to reInitialized my recyclerview when i go from another class then back to the view again?.我想知道当我从另一个 class 的 go 然后再次回到视图时,是否有可能重新初始化我的 recyclerview?

This error shows that you have use lateinit property and didn't initialize it.Do initialize it in onCreate() method.Checkout this https://kotlinlang.org/docs/reference/properties.html#late-initialized-properties-and-variables此错误表明您使用lateinit属性并且没有对其进行初始化。请在onCreate()方法中对其进行初始化。检查此https://kotlinlang.org/docs/reference/properties.html#late-initialized-properties-and -变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 转到 Android Kotlin 中的另一个活动时,材质对话框突然关闭 - Material Dialog suddenly closes when going to another activity in Android Kotlin 转到上一个活动 kotlin 时如何保存 textview 的数据 - how to save data from textview when going to previous activity kotlin Kotlin:如何从另一个班级访问字段? - Kotlin: How to access field from another class? Android (Kotlin) - 无法从另一个 class 访问视图 - Android (Kotlin) - Cannot access view from another class 从另一个类进入catch块时,停止startActivity(intent) - Stop startActivity(intent) when going in catch block from another class 如何从Kotlin中的另一个类获取变量? - How to get a variable from another class in kotlin? 如何在 kotlin 的另一个 class 中使用 function? - How to use function in another class in kotlin? 将块从一个 class 传递到另一个时,如何访问 Kotlin 中的私有成员 - How can I access private members in Kotlin when passing a block from one class to another 如何管理从一个视图转到另一个视图的MotionEvent? - How to manage a MotionEvent going from one View to another? 尝试在 Android Z539A3A5859D24FB7B129E74D61F 中创建视图 model 工厂 class 时出错 - Error when trying to create a view model factory class in Android Kotlin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM