0
try {
        URL url = new URL(this.url);
        InputStream in = new BufferedInputStream(url.openStream());
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int n = 0;
        while (-1 != (n = in.read(buf))) {
            out.write(buf, 0, n);
        }
        out.close();
        in.close();
        byte[] response = out.toByteArray();
        Pixmap pixmap = new Pixmap(response, 0, response.length);
        texture = new Texture(pixmap); // <- here Im getting an exception
    } catch (Exception e) {
        // cause=NullPointerException
        // pixmap was initialized successfully
    }

All the code is working in thread. Code works great in UI thread.

Any ideas?

1 Answers1

3

I think you are not allowed to work with opengl in a thread different from the one where opengl context was created.

http://code.google.com/p/libgdx/wiki/ApplicationThreading