When trying to execute this piece of code:
public void load(String filename) {
FileHandle file = Gdx.files.external(filename + ".bim");
Json json = new Json();
String text = file.readString();
datamap.clear();
datamap = json.fromJson(HashMap.class, text);
I get an error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.SerializationException: Class cannot be created (missing no-arg constructor): com.bvo.easyBim.Model.Cursor at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113) Caused by: com.badlogic.gdx.utils.SerializationException: Class cannot be created (missing no-arg constructor): com.bvo.easyBim.Model.Cursor at com.badlogic.gdx.utils.Json.newInstance(Json.java:915) at com.badlogic.gdx.utils.Json.readValue(Json.java:793) at com.badlogic.gdx.utils.Json.readValue(Json.java:803) at com.badlogic.gdx.utils.Json.fromJson(Json.java:644) at com.bvo.easyBim.View.DataProcessor.load(DataProcessor.java:85) at com.bvo.easyBim.View.World.init(World.java:115) at com.bvo.easyBim.View.WorldRenderer.buttons(WorldRenderer.java:173) at com.bvo.easyBim.View.WorldRenderer.render(WorldRenderer.java:106) at com.bvo.easyBim.Screens.AppScreen.render(AppScreen.java:22) at com.badlogic.gdx.Game.render(Game.java:46) at com.bvo.easyBim.EasyBim.render(EasyBim.java:39) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:187) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110) Caused by: java.lang.InstantiationException: com.bvo.easyBim.Model.Cursor at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at com.badlogic.gdx.utils.Json.newInstance(Json.java:901) ... 12 more
I am trying to translate the json file back into the datamap after It was correctly saved in another piece of code. ( A hashmap ) but this does not seem to work .
I am guessing that he is unable to read the text string, but I actually have no idea what the problem is.