I am new with kotlin android, and I am working with a TextWatcher that iterate an array within my array blanCustomer it consist rows of a textView where user can input a market and edit text for its quantity. what i want to execute is to iterate blankCustomer and trace if there is a changes within the edits but the problem I encountered when I have input in all rows, and i delete the first row textView of the market it should also delete the quantity of that certain row but instead it deletes all of the quantity including the other row. I know that i may have a error with my iteration can you suggest a possible solution on how could I implement it correctly?
for (i in 0 until blankCustomerList.count()) {
blankCustomerList[i].addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(rowGroup: Editable) {
if (rowGroup.isNotBlank()) {
enableQuantityEditText()
}else{
returnQtyToNull()
}
}
override fun beforeTextChanged(rowGroup: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(rowGroup: CharSequence, start: Int, before: Int, count: Int) {
disableQuantityEditText()
newMarketName[i] = rowGroup.toString()
blankName[i].kanji = rowGroup.toString()} })
})