1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Easily Use Threads In Delphi XE5 Android or iOS

Discussion in 'Delphi Android And IOS' started by AdminDF, Feb 26, 2014.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    There is a unit that comes with Delphi XE5 Firemonkey called AnonThread.pas which easily allows you to use threads in your Android and IOS applications. There is also a demo project that comes with XE5 Firemonkey in the Samples/Delphi/RTL/CrossPlatform Utils/AnonymousThread/ directory which shows you how to use them. David Clegg from Embarcadero has a blog post explaining the example and how to use the anonymous threads. One reason to use threads in your IOS application is apparently any synchronous network calls that you do need to be in a thread otherwise you run the risk of your app crashing. Lastly be sure to Synchronize() any graphical control updates. I am including an example procedure below:

    Code:
    procedure RunAnonymousThread;
    var
    FThread: TAnonymousThread<Boolean>;
    begin
    FThread := TAnonymousThread<Boolean>.Create(
    function: Boolean
    begin
    // Runs in separate thread
    // run your thread safe code
    // example:
    //RESTClient.Execute;
    // remember in a thread any graphical changes have to be wrapped in Synchronize()
    //Synchronize(
    //procedure
    // begin
    //    Form1.Memo1.Lines.Add(‘Begin Execution’);
    //  end);
    Result := True;
    end,
    procedure(AResult: Boolean)
    begin
    // Runs in main thread
    // process the result from above
    end,
    procedure(AException: Exception)
    begin
    // Runs in main thread
    // do something if there is an exception
    end,
    False);
    end;

    Download Here
     

Share This Page