I have a button object that I want to make it move on the screen once an activation button is pushed. code:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val target: Button = findViewById(R.id.target)
val text: TextView = findViewById(R.id.textView)
val start: Button = findViewById(R.id.start_rec)
start.setOnClickListener{
var i:Float =1F
while (i<360){
target.x = new_x_position(i)
target.y = new_y_position(i)
text.setText = (target.x.toString()+','+target.y.toString())
handler().postDelayed({movingDot.displayData()}, 1300)
i += 3
}
}
}
problem is the button only moves one single change in position and stays there. the "text" object also shows only first change and does not change when "i" is changing every iterations