Private Sub btnBluethootTest_Click
Dim jo As JavaObject
Try
'Note#1: The class string for InitializeNewInstance is composed of
'1) Package name: in this test case b4a.example (GetPackageName)
'2) The name of the class module in B4A in lowercase. In this case the class module
' name is Test, but since B4A lowercases module names it becomes: test
'3) The name of the class defined in the #if JAVA section (case sensitive): TestThis
'Note#2: You could have a constructor declared. The call here would call one with
' no parameters
Dim classstring As String = Utilita.GetPackageName & ".smartrft.ziwiIntegrator"
Log("NewInstanceOf: " & classstring)
Log(jo2.RunMethod("GetThisActivity",Null))
jo.InitializeNewInstance(classstring,Array(jo2.RunMethod("GetThisActivity",Null)))
jo.RunMethod("GetEVA_Stitch",Array(0,0,112,True))
'Log(jo.RunMethod("getIntent",Null))
intentSendTMP = jo.RunMethod("getIntent",Null)
StartActivityForResult(intentSendTMP)
Catch
Log(LastException)
End Try
End Sub
'Funzione che gestisce il risultato dell'activity
Sub ion_Event (MethodName As String, Args() As Object) As Object
Args(0) = 38796'resultCode
Args(1) = intentSendTMP'intent
Try
'Args(0) = 0x0000978c 'alias 38796
Log("resultCode " & Args(0))
'Args(1) = intentSendTMP
Log("Intent " & Args(1))
jo2.RunMethod("ReturnResponseBluethooth",Array As Object(Args(0),Args(1)))
Catch
Log(LastException)
End Try
Return Null
End Sub
'Funzione che utilizza questo oggetto ion
Sub StartActivityForResult(i As Intent)
Log("entra startactivityresult b4a " & i)
Dim jo As JavaObject = GetBA
ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub
'Ottiene l'istanza del Modulo B4A
Sub GetBA As Object
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetField("processBA")
End Sub