Android Question Shift left long

joop

Active Member
Licensed User
Longtime User
Code: Copy
I have this code :

   Dim testlong As Long = 55
   Dim jo3 As JavaObject
   jo3.InitializeContext
   Log(jo3.RunMethod("ShiftLeft", Array(DateTime.Now, 1)))
   Log(jo3.RunMethod("Shiftleft",Array(testlong, 1)))

#If JAVA
public long ShiftLeft(long N, Integer Shift) {
  return N << Shift;
}
#End If

The output from the shiftleft datetime = 2997514730328 this is ok
But there is no output or error from the shiftleft testlong line.

What is wrong ? should be 110
 
It works ok (result is 110) if you correct the second call (java syntax is case-sensitive).
Code: Copy
   Dim testlong As Long = 55
   Dim jo3 AsJavaObject
   jo3.InitializeContext
   Log(jo3.RunMethod("ShiftLeft", Array(DateTime.Now, 1)))
   Log(jo3.RunMethod("ShiftLeft",Array(testlong, 1)))     '<-- here "Shiftleft" was with a lowercase 'l'

with the original code there was an error as expected
Code: Copy
java.lang.RuntimeException: Method: Shiftleft not found in: com.twouchapps.surface.s1.main
 
Upvote 0
Back
Top