Do I need to send a message to the parent thread to update the imageswitcher? If so, do you have any code samles on how to do that?
Here is a piece of my code.
Using java Syntax Highlighting
- new Thread(r).start();
- .....
- ......
- .....
- Runnable r = new Runnable() {
- public void run() {
- while (!done) {
- updateImage();
- }
- }
- };
- public void updateImage()
- {
- try {
- URL url = new URL(mImageURLIds[num]);
- URLConnection conn = url.openConnection();
- conn.setAllowUserInteraction(false);
- conn.setConnectTimeout(1000);
- conn.setReadTimeout(1000);
- conn.connect();
- InputStream is = conn.getInputStream();
- BufferedInputStream bis = new BufferedInputStream(is);
- Bitmap bm = BitmapFactory.decodeStream(bis);
- bis.close();
- is.close();
- BitmapDrawable bmd = new BitmapDrawable(bm);
- mSwitcher.setImageDrawable(bmd);
- } catch (IOException e) {
- Log.e("UpdateImage:::", e.getMessage(), e);
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Thanks for your help!






