I try to switch the scene of a Gluon application when a custom event is fired.
When I call
MobileApplication.getInstance().switchView(SECONDARY_VIEW);"
I get the error
Exception in thread "Thread-6" java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = Thread-6
This is the listener that handles the custom event
ParallelServerInterface.setLoginResponseListener(new LoginResponseListener() {
@Override
public void loginResponseReceived(LoginResponse loginResponse) {
Map<String, String> source = (Map<String, String>) loginResponse.getSource();
boolean status = source.get("status").equals("true");
if (status) {
MobileApplication.getInstance().switchView(SECONDARY_VIEW);
}
}
});
How can this be resolved?