I have a button that when pressed, is supposed to create a new editText inside a recyclerView. And this should be repeatable until a set limit. Ex. 5 EditTexts.
I have tried this code below, but when the button is pressed, the app just crashes.
// add is the btn id
add.setOnClickListener {
val newText = EditText(this)
//recyclerView is Recycler View in activity_main
recyclerView.addView(newText)
}
How could I go about this?