I am trying to initialize an ImageView in companion object as I want the methods to be static but I have an error is there an alternative approach below is my code
companion object {
lateinit var bufferingAnimation : LoadingAnimation
var bufferingIndicator = findViewById(R.id.loading)
fun startBufferingAnimation() {
bufferingAnimation = LoadingAnimation(bufferingIndicator)
bufferingAnimation.startAnimation()
}
fun stopBufferingAnimation() {
bufferingAnimation.clearAnimation()
}
}
I am not able to initialize bufferingIndicator is there any alternate approach?