Program continue running before touch action performed

Hello. Why program continue running before touch action (tap) performed?
It seems like touch action method running in parallel.
How can I ‘suspend’ program until touch action is actually performed?
I have to use thread.sleep, but is there correct solution?
Is there a way to wait until touch action is finished?