when I use Thread.sleep()
for the delay in my app I get crash InterruptedException
.
I have to use Thread.sleep()
because I send Command to hardware and need to get data after 1 second.
can I use RX java for this problem? or other ways?
Yes you can replace Thread.sleep()
in RX java using delay
in Observable. Here how to do it:
Observable.delay(5000, TimeUnit.MILLISECONDS)
using interval
will do thing infinite time at the interval
of provided time.