How to use uno.thread

Hi everyone, I’m newbie. I want to create a function in uno that need use uno.threading in order to synchronize But I can’t find any sample code about uno.threading. Example code:

using Android.ActivityUtils; … … ActivityUtils.StartActivity(intent, OnResult); debug_log “finish start Activity”;

Comment: intent is a data type make intent in android (never mind for this) OnResult is my function that when starting Activity intent complete, it will callback OnResult function.

But when I activate the code, I’ve got the ‘finish start Activity’ before callback OnResult activated. So I watn it activate OnResult first and then go to debug_log “finish start Activity”; after

So I see the Uno.threading I think it can handle this for synchronizing, but I don’t know how to use it.

Device: Android.

Thank you.

If you are trying to make an intent from Uno, you should use foreign code. Here is an example:

[ForeignInclude(Language.Java, "com.fuse.Activity", "android.content.Context", "android.content.Intent", "")]
public class MyCustomModule
    public static extern(Android) void AndroidLaunch(string filepath)
        try {
            Uri uri = Uri.parse(filepath);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(uri, "application/pdf");
        } catch (Exception e) {