Hi All!
I need using inline java. That worked well, but now I have to transform one of Bitmap parameter to Bitmap[].
Here is the called function header:
B4X:
public void printinvoice( BA ba,String s, Bitmap[] bmp)
java.lang.RuntimeException: Method: printinvoice not matched.
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:130)
at b4a.mypos.myposclass._printinvtext(myposclass.java:380)
What is the correct calling?
Thanks in advance
Steven
Sorry @Erel , but I have more question related this. Now I would like to pass a real bitmap array to mentioned java function.
B4X:
Public Sub printInvText2(text As String,bmp() As Bitmap)
Dim bmpArray As JavaObject
bmpArray.InitializeArray("android.graphics.Bitmap", bmp)
If bmp .Length = 0 Then
Log("printinvtext kép nélkül")
MEJo.RunMethod("printinvoice", Array(GetBA,text,bmpArray))
Else
Log("printinvtext képpel")
MEJo.RunMethod("printinvoice", Array(GetBA,text,bmpArray))
End If
End Sub
The calling code:
B4X:
Dim bmp,bmp1 As B4XBitmap
effects.Initialize
bmp = LoadBitmapResize(File.DirAssets,"rafi_szines.png",500dip,500dip,True)
bmp1 = LoadBitmapResize(File.DirAssets,"iqom.png",500dip,500dip,True)
Dim szoveg As String = $"Kép előtt${mp.PR_PICT_PLACE}kép után.${mp.PR_PICT_PLACE}Másik kép után."$
mp.printInvText2(szoveg,Array As Bitmap(effects.GreyScale(bmp).As(Bitmap),effects.GreyScale(bmp1).As(Bitmap)))
Compiled well, give error:
B4X:
** Activity (main) Resume **
myposclass_printinvtext2 (java line: 396)
java.lang.IllegalArgumentException: Array has incompatible type: class [Landroid.graphics.Bitmap;
at java.lang.reflect.Array.incompatibleType(Array.java:827)
at java.lang.reflect.Array.set(Array.java:477)
at anywheresoftware.b4j.object.JavaObject.InitializeArray(JavaObject.java:109)
Public Sub printInvText2(text As String,bmp() As Object)
Dim bmpArray As JavaObject
bmpArray.InitializeArray("android.graphics.Bitmap", bmp)
If bmp .Length = 0 Then
Log("printinvtext kép nélkül")
MEJo.RunMethod("printinvoice", Array(GetBA,text,bmpArray))
Else
Log("printinvtext képpel")
MEJo.RunMethod("printinvoice", Array(GetBA,text,bmpArray))
End If
End Sub