Jump to content
Sign in to follow this  
limelect

Using Thread

Recommended Posts

In an application, I am using Marco Cantu https://blog.marcocantu.com/blog/2014_may_background_delphi_android_threads.html

Thread. 

I have 2 questions

1.  I am concerned pressing a button many times does not leave-in memory

     the last thread or do I have to make sure that before I create a new

    TThread.CreateAnonymousThread(procedure () that the old one does not exist?

2. On the same program, I would like to use Toast. (Using Notify works).

    I am trying to put  Toast in Synchronize

 

  TThread.Synchronize(TThread.CurrentThread,
    procedure()
    begin
   {$IFDEF POSIX}
     ToastManager1.Toast('Finished Loading Contacts');
 // ToastManager1.
  //  FMXToast1.ToastMessage:='aaaaaa';
 //   FMXToast1.Show(self);
  //   NotifyComplete;
      {$ENDIF}
    end);
Android gives me a message NO DUPLICATE ALLOWED.

So I guess I have to put the TOAST statement outside the thread.

Any idea how to?

I could put a flag and with timer use it but I do not like the idea.

 

 

Edited by limelect

Share this post


Link to post

It seems that moving the toast function to another form is

the solution to my second question. I wonder why?

Still, if someone can answer the first question.

Thanks

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×