Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: how to make Delphi FMX Thread For Android


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Nov 25, 2016 8:23 AM Last Post By: Markus Humm
Guest
how to make Delphi FMX Thread For Android
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 24, 2016 7:31 AM
Excuse me everything

I want to ask, how to make thread for Delphi FMX Android
My confusion here how to make thread and apply it.

thank you...
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: how to make Delphi FMX Thread For Android  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 24, 2016 9:24 AM   in response to: Guest in response to: Guest
Am 24.11.2016 um 16:31 schrieb sapta dwi husein:
Excuse me everything

I want to ask, how to make thread for Delphi FMX Android
My confusion here how to make thread and apply it.

thank you...

Hello,

I'm not sure yet what you're after exactly but:
If you run some code in a thread make sure you do not directly call any
FMX stuff from within that thread. It must always be called via
synchronize or so, otherwise your app will randomly crash.

Now for using threads there are different approaches availalbe:

The good old TThread class. You create your own class inherting from
this and overriding the execute method. Everything you put into your
execute method is run iside your thready, everything else even when
being in your TThread descendand is not.

Then there's TTask which can run some method you name it in asynchronous
fashion.

But depending on what you want to do you might be able to do so without
a thread at all. Sometimes all you need is a TTimer...

Greetings

Markus
Guest
Re: how to make Delphi FMX Thread For Android
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 25, 2016 12:38 AM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:
Am 24.11.2016 um 16:31 schrieb sapta dwi husein:
Excuse me everything

I want to ask, how to make thread for Delphi FMX Android
My confusion here how to make thread and apply it.

thank you...

Hello,

I'm not sure yet what you're after exactly but:
If you run some code in a thread make sure you do not directly call any
FMX stuff from within that thread. It must always be called via
synchronize or so, otherwise your app will randomly crash.

Now for using threads there are different approaches availalbe:

The good old TThread class. You create your own class inherting from
this and overriding the execute method. Everything you put into your
execute method is run iside your thready, everything else even when
being in your TThread descendand is not.

Then there's TTask which can run some method you name it in asynchronous
fashion.

But depending on what you want to do you might be able to do so without
a thread at all. Sometimes all you need is a TTimer...

Greetings

Markus


I've got the solution sir

while I use like this

Tthread.CreateAnonymousThread (
  procedure begin

// Something Here

tthread.Synchronize (tthread.CurrentThread,
      procedure begin

// Something Here

end);

  end) .Start;

possibly from other friends who can add to sir

Edited by: sapta dwi husein on Nov 25, 2016 3:39 PM

Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: how to make Delphi FMX Thread For Android [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 25, 2016 8:23 AM   in response to: Guest in response to: Guest
Am 25.11.2016 um 09:39 schrieb sapta dwi husein:

I've got the solution sir

while I use like this

Tthread.CreateAnonymousThread (
procedure begin

// Something Here

tthread.Synchronize (tthread.CurrentThread,
procedure begin

// Something Here

end);

end) .Start;

possibly from other friends who can add to sir

Edited by: sapta dwi husein on Nov 25, 2016 3:39 PM

Hello,

your solution should work.
So I gues your question is answered now?

Greetings

Markus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02