I am creating a custom component in HarmonyOS using Java SDK, Where I have to perform some task after some delay with Component instance.
In Android, we have postDelayed(Runnable action, long delayMillis)
method in View class. So we can achieve above requirement as follow
view.postDelayed(runnable, 100);
but, In HMOS java SDK, I seen there is no any api available for delay in Component class.
So, My question is
What is the equivalent of view.postDelayed(Runnable action, long delayMillis) in harmonyos ?
currently HarmonyOS doesn't provide exact alternative for View.postDelayed(..) , Instead you can achieve similar UI post functionality using ohos.eventhandler.EventHandler API, Sample Usage is as follows
EventHanlder eventhandler = new EventHandlder(EventRunner.getMainEventRunner());
eventhandler.postTask(runnable, timeInMillis);