Android Question Problem Passing Byte to JavaObject Method

Richard Goh

Active Member
Licensed User
Longtime User
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?

B4X:
    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))
 

Richard Goh

Active Member
Licensed User
Longtime User
I tried both. Also having the same error message.

Dim Buffer() As Byte
Buffer = ArrayAs Byte(0x01)
jo.RunMethodJO("SetAlignMode", Array(Buffer))
 
Upvote 0

Richard Goh

Active Member
Licensed User
Longtime User
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
Top