title: Getting this error in findViewById() in the ImageView widget
body: <p>This is my code of a dice roll app showing image dice 1 for now. The findViewById() is working fine with the textview but it's showing error with the image. This line</p>
  <pre class="lang-kotlin prettyprint-override"><code>    val diceImage: ImageView = findViewById(R.id.imageView)
  </code></pre>
  <p>The IDE is suggesting to create a function. How should I resolve it? I'm new to Kotlin and Android Studio.</p>
  <pre class="lang-kotlin prettyprint-override"><code>package com.unnati.diceroll
  
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import android.widget.Button
  import android.widget.ImageView
  
  /* these lines allows user to roll the dice and show on the screen */
  class MainActivity : AppCompatActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val rollButton: Button = findViewById(R.id.button)
          rollButton.setOnClickListener {
              rollDice()
          }
      }  }
  //roll the dice and show on the screen
      private fun rollDice() {
          val dice = Dice(6)
          val diceRoll = dice.roll()
  
          val diceImage: ImageView = findViewById(R.id.imageView)
          diceImage.setImageResource(R.drawable.dice_1)
  }
  
  
  
  class Dice(val numSides: Int) {
      fun roll(): Int {
          return (1..numSides).random()
      }
  }
  </code></pre>