Wednesday, 23 February 2022

can anyone help understanding kotlin code below

Since I don't know kotlin, so please anyone who know kotlin and Java please convert the below code to java it would really help me.

here is the code:

private var checkedRadioButton: CompoundButton? = null

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.itemView.radio_button.setOnCheckedChangeListener
 (checkedChangeListener)

if (holder.itemView.radio_button.isChecked) checkedRadioButton = 
 holder.itemView.radio_button
 }

 private val checkedChangeListener = 
 CompoundButton.OnCheckedChangeListener { compoundButton, isChecked 
 ->
checkedRadioButton?.apply { setChecked(!isChecked) }
checkedRadioButton = compoundButton.apply { setChecked(isChecked) }
}

please help!



from can anyone help understanding kotlin code below

No comments:

Post a Comment