title: How can I access to data class object from activity?
body: <p>I am trying to access to data class (<code>Content</code>)and I would like to use object(<code>val isSelected: Boolean?</code>)from <code>PictureActivity</code>. However, it causes <code>UninitializedPropertyAccessException: lateinit property content has not been initialized</code>. Do you know how to solve this situation? I used lateinit but I don't even know if using lateinit is the best way to access to data class(Content). If you know other way to access to it, please let me know.</p>
  <p>The code is down below.</p>
  <p>Content.kt</p>
  <pre class="lang-kotlin prettyprint-override"><code>data class Content(
      val id: Int,
      val text: String,
      val isSelected: Boolean?,
      val url: String?
  )
  </code></pre>
  <p>PictureActivity.kt</p>
  <pre class="lang-kotlin prettyprint-override"><code>class PictureActivity : BaseActivity() {
  
      private lateinit var binding: PictureActivityBinding
  
      private lateinit var content: Content
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          binding = PictureActivityBinding.inflate(layoutInflater)
          setContentView(binding.root)
       
          if(content.isSelected!!){
             binding.button1.setOnClickListner{
             startContentDownload(content.url!!)
               return@setOnClickListener
          }
       }
       private fun startContentDownload(url: String) {
          //download image
      }
    }
  }
  </code></pre>