I found amazing things about Thread.sleep. The thread does not wake up on time. Let me explain. I create an action (no maintenance) and start the thread as shown below.
Thread.sleep(50000); // 50 seconds System.out.println("something");
Then I keep the activity in the foreground and off (by pressing the power button). I also registered the file saved in sdcard. What I found After almost 10 minutes Delayed flow 7.35 minutes to print instead of 50 seconds. This is normal? Can I trust Thread.sleep ()?
16:47:57 ---- START -------- -------- (all are in time) -------- 16:57:07 -- (in time) 16:57:57 -- (in time) 17:05:38 --- (late)
java android multithreading
shantanu
source share