Java Question raiseEvent2 causing ArrayIndexOutOfBoundsException

Ddddimmma

Member
Licensed User
Longtime User
Hi,
I am trying to post an event from a native library (java) back to b4a.
I also need the event to be received while the activity is paused, so i tried raiseEvent2.
My usage:
ba.raiseEvent2(sender, true, eventName, false, eventParams);
Doing so, i am getting the following error:
~e:java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1

Could you please assist?
BTW, using raiseEventFromDifferentThread works but it dispatches the event to a message queue and the event would run upon activity resume - not a good solution for us because we need to notify the client activity that the event occurred event if it is paused.
 

Ddddimmma

Member
Licensed User
Longtime User
This is my code:
// run on main thread
Handler mainHandler = new Handler(ba.context.getMainLooper());
Runnable myRunnable = new Runnable() {
@override
public void run() {
ba.raiseEvent2(sender, true, eventName, false, eventParams);
}
};
mainHandler.post(myRunnable);

I don't see other exception information (in adb) except the following line:
09-24 15:30:03.354: I/B4A(578): ~e:java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
 
Top