App crashing when i press this button

this crashes my device

any idea why?

you have an infinite while loop causing a memory overload

how should i fix it then

please tell, i gtg soon thanks

The simple way is not use a while loop.

The immediate issue is your loop condition is always true (because you set the struck out blocks to 1) so



might get you a better result (but probably will not)

but i need it to repeatedly loop through and choose random songs until a button is clicked, changing the shuffle to 0

Actually you do not. Use a Clock. ...and the code you propose doesn't work anyway.

how long should i set the delay? (timerinterval)

nvm i set it to 100 and it works fine, thanks for ur help!