Pues quiero cargar una imagen en un actor Image a partir de una url, y me dice que "couldn't load pixmap unknown image type"
Para hacer el get estoy usando una librería aparte, y la url es " http://178.62.163.110:3000/maps/getImage/2837507309sdasd5sdf.png "
el codigo:
AsyncHttpClient client = new AsyncHttpClient();
try {
Future<String> f = client.prepareGet(map.image).execute(new AsyncCompletionHandler<String>() {
@Override
public String onCompleted(Response response) throws Exception {
Pixmap maPixmap = new Pixmap(response.getResponseBody().getBytes(), 0, response.getResponseBody().getBytes().length);
logo = new Image(new Texture(maPixmap));
maPixmap.dispose();
return "";
}
});
f.get();
} catch (Exception e) {
e.printStackTrace();
}
la excepción:
Excepcionjava.util.concurrent.ExecutionException: java.lang.RuntimeException
at com.ning.http.client.providers.jdk.JDKFuture.get(JDKFuture.java:138)
at com.ning.http.client.providers.jdk.JDKFuture.get(JDKFuture.java:116)
at com.treecat.tdengine.views.MapView.<init>(MapView.java:49)
at com.treecat.tdengine.screens.MapPicker.show(MapPicker.java:69)
at com.badlogic.gdx.Game.setScreen(Game.java:61)
at com.treecat.tdengine.screens.MainMenu$1.clicked(MainMenu.java:53)
at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89)
at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:57)
at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:272)
at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:305)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:199)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: java.lang.RuntimeException
at com.ning.http.client.providers.jdk.JDKAsyncHttpProvider$AsyncHttpUrlConnection.call(JDKAsyncHttpProvider.java:369)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load pixmap from image data
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:127)
at com.treecat.tdengine.views.MapView$1.onCompleted(MapView.java:42)
at com.treecat.tdengine.views.MapView$1.onCompleted(MapView.java:1)
at com.ning.http.client.AsyncCompletionHandler.onCompleted(AsyncCompletionHandler.java:63)
at com.ning.http.client.providers.jdk.JDKAsyncHttpProvider$AsyncHttpUrlConnection.call(JDKAsyncHttpProvider.java:364)
... 5 more
Caused by: java.io.IOException: couldn't load pixmap unknown image type
at com.badlogic.gdx.graphics.g2d.Gdx2DPixmap.<init>(Gdx2DPixmap.java:57)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:125)
... 9 more