title: How to pass data/object from fragment to activity in kotlin
body: <p>I am tring to pass a list of datas from a fragment to a activity using intent. When sending the data from fragment, the data is exist. But in activity the its says data is null. I am not sure if the way i pass the data is correct or not or is there any better way to pass the data from fragment to activity?</p>
  <p>In Fragment</p>
  <pre><code>private var selectedBankCard: Channels = Channels //get a list of data from BE
      override fun onClick(view: View?) {
          when (view?.id) {
              R.id.bankcard_layout -&gt; {
                      try {
                          if (activity != null) {
                              val intent =
                                  Intent(context, BankCardListActivity::class.java)
                              if (selectedBankCard != null) {
                                  intent.putExtra(&quot;BANKCARDINFORMATION&quot;, selectedBankCard) //upon debug, i can see a selectedBankCard is not null
                              }
                              startActivityForResult(intent, 10001)
                          }
                      } catch (e: Exception) {
                       
                      }
                  }
              }
          }
      }
  </code></pre>
  <p>In Activity</p>
  <pre><code>class AutoReloadBankCardListActivity : BaseActivity() {
  private lateinit var channels: Channels
     override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.bank_card)
          if (intent == null) {
              return
          }
          channels = intent.getSerializableExtra(&quot;BANKCARDINFORMATION&quot;) as Channels // upon debug, getSerializableExtra returns null
          
      }
  
  
  class Channels : Serializable {
      var newCard = false
      var disable = false
      var disableCode: String = &quot;&quot;
      var description: String = &quot;&quot;
      var channelType: String = &quot;&quot;
      var payBrands: List&lt;String&gt;? = null
      var channelIndex: String = &quot;&quot;
      var payToolType: String = &quot;&quot;
      var selected = false
      var payBrand: String = &quot;&quot;
      var extendInfo: ExtendInfo? = null
      var disableReason: String = &quot;&quot;
      var icon: String = &quot;&quot;
      var chargeIndex: String = &quot;&quot;
  
  }
  </code></pre>