Hello!

Hello!

Anyone has had to deal with Java Runnables in FMX?
I have no idea of how to work with this, any examples would be great :)

Dalija Prasnikar have you ever wrestled with this? I know you do Java :)

Thanks!

Comments

  1. I have but in Java :)

    Question is, why you need Runnable in Delphi? You have TTask and anonymous threads. They fit better.

    ReplyDelete
  2. Dalija Prasnikar because the code I am trying to call comes from a Java import :)

    ReplyDelete
  3. Well, that is pretty general question. I mean without knowing any details what you have and what is the problem I can hardly give you more specific answer.

    Generally, Java code translates to Delphi rather easily and for how to use some particular class the best option is to read original Android documentation.

    I you can provide more details...

    ReplyDelete
  4. We have a Cordova App that my project should substitute. There's a class in there called "CMAIO" that has a method which takes 3 parameters:

    1) User (this is another class)
    2) Runnable 1
    3) Runnable 2

    My general understanding is that the first runnable is used for success and the second for failure. My issue is - obviously - that by the end of the call I need to know what happened and which was called. And r/n I have no clue how.

    ReplyDelete
  5. OK, here is very basic code from top of my head

    type
    TRunnable = class(TJavaLocal, JRunnable)
    public
    procedure run; cdecl;
    end;

    procedure TRunnable.run;
    begin
    // callback code
    end;

    FRunnable := TRunnable.Create;

    pass FRunnable as parameter

    ReplyDelete

Post a Comment