I have converted this code from Java to Kotlin using Android Studio 3.0
internal var background: Drawable
internal var xMark: Drawable
private fun init() {
background = ColorDrawable(Color.RED)
xMark = ContextCompat.getDrawable(this@Subscriptions_main, R.drawable.delete)
}
On line 1 and 2 I'm getting the error:
Property must be initialized or be abstract
even though it is going to be initialized in the init function.
Is writing:
internal var background: Drawable? = null
internal var xMark: Drawable? = null
a viable and efficient solution? Is there any other better way?