public class ScanDevicesActivity extends AppCompatActivity implements ModuleIface {
public void onItemClick(View v, int position) {
ModuleIface.init(this,ModuleIface.this)
}
@Overridepublic
void onStatusChange(int statusCode)
{
}
}
When Call the ModuleIface.init the library call automatically onStatusChange, how can I intercept this event?
The object of the init are:
- Context
- ModuleIface
My try in B4A:
B4X:
#AdditionalJar: mylibrary
Sub Test()
Dim R2 as Reflector
Dim Jo As JavaObject
Jo.InitializeNewInstance("mylibrary.KeyModule",Null)
Dim CallBack As Object = Jo.CreateEvent("onStatusChange", "Callback", Null)
jo.RunMethod("init",Array(r2.GetActivity, e))
End Sub
Sub Callback_Event (MethodName As String, Args() As Object) As Object
Log("onStatusChange")
End If
sub Test()
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim Jo As JavaObject
Jo.InitializeNewInstance("mylibrary.KeyModule",Null)
Dim CallBack As Object = Jo.CreateEventFromUI ("full.package.name.ModuleIface", "Callback", Null)
Jo.RunMethod("init",Array(ctxt, CallBack))
end sub
Sub Callback_Event (MethodName As String, Args() As Object)
Log(MethodName)
Log("onStatusChange")
End Sub
The MethodName is Always "ToString". How can I intercept the correct method name?