I am writing a little picture frame app for android that is using opengl for part of the UI. This portion needs to get images from flickr and load them into a texture. The code I have below is functional most of the time, but it has a Thread.sleep() kludge in between getting the input stream from the connection and the bitmap factory decoding the stream:
URL url = new URL("http://farm5.static.flickr.com/4132/5168797476_7a85deb2be_b.jpg");
URLConnection con = url.openConnection();
InputStream is = con.getInputStream();
Thread.sleep(250); //What am I actually waiting for?
sourceBitmap = BitmapFactory.decodeStream(is);
How do I get around using the sleep() method in favor of something that makes logical sense?
I am testing on a samsung galaxy tab not in the emulator