Remove button over a button Kotlin

  android, android-studio, button, kotlin

I am coding the functionality of a button that serves to remove other buttons. My buttons are dynamic. I have to program the functionality in my .kt. I am noob on android studio so am not sure what the best way to do it.

The function is like this:

enter image description here

I have a TableRow where are my buttons. All this buttons have their own listener.

val param: TableRow.LayoutParams =TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.MATCH_PARENT)

var buttondynamic = Button(this)
buttondynamic = buildButton(item, i, mysize, mysize, true)

buttondynamic.layoutParams = param
tr.addView(buttondynamic)

Also I have a listener for the trash button but I don’t know how to make the action works. How I should code this? Hove you some idea?

trashButton.setOnClickListener { ... }

On the other hand, I have the code for the delete button listener. I only need the idia for the remove button over a button.

Thank you so much

Source: Android Questions

LEAVE A COMMENT