The view is created dynamically in the code:
val textView = TextView(context).apply {
setTextColor(Color.BLACK)
setPadding(5,20,5,0)
text = label
id = lblID
}
linearLayout.addView(textView)
At some point, I need to get this view by ID in my fragment.
In fragment I use binding to access static views defined in XML:
private var _binding: FragmentDataBinding? = null
private val binding get() = _binding!!
But, I do not know how to access dynamically created views by id.
How can I access programmatically the views that are created dynamically as in the example above by ID?