java - Calling thread repeatedly causing Ui hang in android -




i developing bluetooth application.in have 1 button, on click of button starting thread.inside thread, discovering , connecting ble devices.repeated click of button causing ui hang.

code using create thread is:

new thread(new runnable() {             @override             public void run() { //do bluetooth stuffs              }         }).start(); 

i not stopping thread anywhere.

i don't know causing ui hang please me.

do mean if keep smashing button repeatedly (without waiting task finish), ui lags? or when press button, wait bit, press again.

if it's first case (where you're mashing button in quick succession), try this: if set boolean flag when first start process, each time press button check if flag set true, , execute search if flag false. not sure if issue it's worth shot?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -