Apr 17, 2024 Replies: 4 1. Download attached library and put in additional libraries folder. 2. Add to main module: Code: Copy #AdditionalJar: core-lambda-stubs.jar, ReferenceOnly Example: Code: Copy 'in B4XPage #if java import java.util.*; public void test() { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); numbers.forEach( (n) -> BA.Log("" + n) ); } #End If Code: Copy Me.as(JavaObject).RunMethod("test", Null) Attachments core-lambda-stubs.jar core-lambda-stubs.jar 17.7 KB · Views: 506 Click to expand...
1. Download attached library and put in additional libraries folder. 2. Add to main module: Code: Copy #AdditionalJar: core-lambda-stubs.jar, ReferenceOnly Example: Code: Copy 'in B4XPage #if java import java.util.*; public void test() { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); numbers.forEach( (n) -> BA.Log("" + n) ); } #End If Code: Copy Me.as(JavaObject).RunMethod("test", Null)
LucaMs Expert Licensed User Longtime User Apr 17, 2024 #2 I have two questions; maybe I should open a new trhead, but one of the two is relevant (the other less so ?). Should this snippet also work in B4J? The way you called the test method. It is much simpler than what is shown in the tutorial about inline Java, where you use: NativeMe.InitializeContext
I have two questions; maybe I should open a new trhead, but one of the two is relevant (the other less so ?). Should this snippet also work in B4J? The way you called the test method. It is much simpler than what is shown in the tutorial about inline Java, where you use: NativeMe.InitializeContext
Erel B4X founder Staff member Licensed User Longtime User Apr 17, 2024 #3 1. Yes, and the #AdditionalJar isn't needed. 2. The InitializeContext is required when running inline code inside activities.
1. Yes, and the #AdditionalJar isn't needed. 2. The InitializeContext is required when running inline code inside activities.
Daestrum Expert Licensed User Longtime User Apr 17, 2024 #4 Is it Code: Copy Me.As(JavaObject). ... or Code: Copy (Me).As(JavaObject). ... As 'Me' doesn't appear to have .As as a method. After-thought: it could be in the jar I forgot to add
Is it Code: Copy Me.As(JavaObject). ... or Code: Copy (Me).As(JavaObject). ... As 'Me' doesn't appear to have .As as a method. After-thought: it could be in the jar I forgot to add
Erel B4X founder Staff member Licensed User Longtime User Apr 17, 2024 #5 Daestrum said: As 'Me' doesn't appear to have .As as a method. Click to expand... This is an IDE bug. You can use As with Me.
Daestrum said: As 'Me' doesn't appear to have .As as a method. Click to expand... This is an IDE bug. You can use As with Me.