Hi All,
I have to intercept, from an Android device, an event raised from a library of the device.
I added the library with
In this library there is an "IButton" object that I initialize with JavaObject
Now I have to intercept the event, by a callback, when is read from the device a sort of key.
I tried with two paths:
In the first one I use "CreateEvent" with JavaObject:
But the sub "Test_Event" is never called.
This is how it's implemented
And here and exaple for the callback:
Where "setCallback" is used to register the event, "Register a call-back handler. By registering, the call-back handler is called when an event occurred."
Then we tryed to use inline java code to get the event for then call an a B4A Sub with
Do you have any ideas?
Ask me if you need more informations
Best regards
I have to intercept, from an Android device, an event raised from a library of the device.
I added the library with
B4X:
#AdditionalJar: companyregdevicelibrary
In this library there is an "IButton" object that I initialize with JavaObject
B4X:
Dim CompDevice As JavaObject
CompDevice.InitializeNewInstance("jp.co.company.vx.framework.device.IButton",Array As Object())
status = CompDevice.RunMethod("open",Array As Object(CompDevice.GetField("OPENMODE_COMMON"),CompDevice.GetField("DEVICE_HOST_LOCALHOST")))
Now I have to intercept the event, by a callback, when is read from the device a sort of key.
I tried with two paths:
In the first one I use "CreateEvent" with JavaObject:
B4X:
CompDevice.CreateEvent("jp.co.company.vx.framework.device.IButton.StatCallback","Test",False)
'OR
CompDevice.CreateEventFromUI("jp.co.company.vx.framework.device.IButton.StatCallback","Test",False)
This is how it's implemented
B4X:
public interface StatCallback
{
void onChangebutton(boolean stat, byte[] data);
};
B4X:
public class MainActivity extends Activity
implements IButton.StatCallback {
:
void onChangeIbutton(boolean stat, byte[] data) {
// this procedure should be implemented
:
}
:
int initXXX() {
setCallback(this); // register callback
:
}
}
Where "setCallback" is used to register the event, "Register a call-back handler. By registering, the call-back handler is called when an event occurred."
Then we tryed to use inline java code to get the event for then call an a B4A Sub with
B4X:
activityBA.raiseEvent(activityBA, "test123", "");
Do you have any ideas?
Ask me if you need more informations
Best regards