Issue
I want to wait 5 seconds before starting another public void method. The thread sleep was not working for me. If there is a way of wait()
without using Threads I would love to know that.
public void check(){
//activity of changing background color of relative layout
}
I want to wait 3 seconds before changing the relative layout color.
Solution
just add one-liner with lambda
(new Handler()).postDelayed(this::yourMethod, 5000);
edit for clarification: yourMethod
refers to the method which you want to execute after 5000 milliseconds.
Answered By - Mike Antipiev
Answer Checked By - Pedro (JavaFixing Volunteer)