What could be the cause of this error? (Can't figure it out)
Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 16
at com.badlogic.gdx.scenes.scene2d.ui.TextArea.continueCursor(TextArea.java:331)
at com.badlogic.gdx.scenes.scene2d.ui.TextArea.calculateOffsets(TextArea.java:278)
at com.badlogic.gdx.scenes.scene2d.ui.TextField.draw(TextField.java:283)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:124)
at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:58)
at com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw(WidgetGroup.java:154)
at com.badlogic.gdx.scenes.scene2d.ui.Table.draw(Table.java:123)
at com.badlogic.gdx.scenes.scene2d.Group.drawChildren(Group.java:111)
at com.badlogic.gdx.scenes.scene2d.Group.draw(Group.java:58)
at com.badlogic.gdx.scenes.scene2d.Stage.draw(Stage.java:128)
at se.scapegoat.channelsclient.screens.AbstractScreen.render(AbstractScreen.java:36)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:207)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Is this due to thread-safety issue possibly -Can I not set text from wherever?
It's very likely to be a threading issue as you suggest.
The code referenced by your stacktrace is looping through every character in the string. If you changed the string to a shorter one in the middle of the loop it would cause exactly this sort of issue.
One way around this would be to run your text-changing code using
Application.postRunnable()
LibGdx is not inherently thread-safe, and whilst it's possible to write threaded code that uses it, you have to be careful about what happens on what threads.
There's some information on libgdx threading on this page.