Richard Goh Active Member Licensed User Longtime User Jun 21, 2016 #1 Hi, I have a java class with a method, public void SetAlignMode(byte AlignMode). But when I try to call the method, using below code from my program, I received java.lang.RuntimeException: Method: SetAlignMode not matched. Any advice? Code: Dim A_FLAG As Int A_FLAG = 0x01 jo.RunMethodJO("SetAlignMode", Array(A_FLAG)) 'or Dim Buffer() As Byte Buffer = Array As Byte(0x01) jo.RunMethodJO("SetAlignMode", Array(Buffer))
Hi, I have a java class with a method, public void SetAlignMode(byte AlignMode). But when I try to call the method, using below code from my program, I received java.lang.RuntimeException: Method: SetAlignMode not matched. Any advice? Code: Dim A_FLAG As Int A_FLAG = 0x01 jo.RunMethodJO("SetAlignMode", Array(A_FLAG)) 'or Dim Buffer() As Byte Buffer = Array As Byte(0x01) jo.RunMethodJO("SetAlignMode", Array(Buffer))
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2016 #2 A_FLAG should be declared as Byte instead of Int. Upvote 0
Richard Goh Active Member Licensed User Longtime User Jun 21, 2016 #3 I tried both. Also having the same error message. Dim Buffer() As Byte Buffer = ArrayAs Byte(0x01) jo.RunMethodJO("SetAlignMode", Array(Buffer)) Upvote 0
I tried both. Also having the same error message. Dim Buffer() As Byte Buffer = ArrayAs Byte(0x01) jo.RunMethodJO("SetAlignMode", Array(Buffer))
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2016 #4 The code you posted is incorrect. You are passing an array of bytes instead of a single byte. Upvote 0
Richard Goh Active Member Licensed User Longtime User Jun 21, 2016 #5 Thanks again. I was searching around on the forum for this. It's worked after I change to use a single byte as below. Dim b As Byte = 0x01 Upvote 0
Thanks again. I was searching around on the forum for this. It's worked after I change to use a single byte as below. Dim b As Byte = 0x01
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2016 #6 This code will work: Code: Dim A_FLAG As Byte A_FLAG = 0x01 jo.RunMethodJO("SetAlignMode", Array(A_FLAG)) Upvote 0
This code will work: Code: Dim A_FLAG As Byte A_FLAG = 0x01 jo.RunMethodJO("SetAlignMode", Array(A_FLAG))