Android Question Call B4A sub from library

kiki78

Active Member
Licensed User
Longtime User
I want to construct Runnable in java library that call B4A code.
But I never found the way to do that.

For example I expect to pass object that contain sub and string with sub name and have a constructor to make runnable with that .

Does some one put me on right way ?

Regards
 

kiki78

Active Member
Licensed User
Longtime User
Thank you Erel,
I already consider that as workaround.
But as I never know in advance the function name is it possible, for example, to construct Runnable object in Basic side and pass it to library ?

Regards
 
Upvote 0

kiki78

Active Member
Licensed User
Longtime User
Thank you Erel,
My question is not how to raise events, but how to call Basic function without using BA raiseevent method, if it's possible.
In BA, I see method runHook but I never found doc.

Regards,
 
Upvote 0

kiki78

Active Member
Licensed User
Longtime User
So I explain more my project.

I do intensive calculation.
Code is write in Basic, originally .NET then translate to B4A.
In .NET I use Parallel.For to distribute calculation in multiple thread and better use multi-core processor.
In B4A I make a class for ParallelFor in Basic using Agraham Threading library.
Each class of my math library (vector, matrix, etc...) have property to associate, or not, instance of ParalleleFor class then this is propagate to results.

But this implementation in Basic it's not really efficient, so I try to use java.util.concurrent.

For now I test it with raiseEvent, and it's already better, but to correctly distribute call, I need to have Basic + Java library with this step :
- Receive call to Basic ParallelFor class with function name, container and list of item to loop.
- Call Java ParallelFor class for launching concurrent thread that raiseEvent and wait termination.
- Receive events in Basic ParallelFor class to callback correct calculation function.

If I can directly call basic function from Java code, I can completely remove Basic part and I expect better result.

I expect it's more clear now.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top