How to execute a long non UI function without freeze UI?

Hi all,

Is there a way to execute a long running function to load the data asynchronously without blocking the UI thread and then a callback to update the UI?

Thanks in advanced,