Created
October 18, 2011 07:12
-
-
Save takuo/1294790 to your computer and use it in GitHub Desktop.
Android code snippet - using Thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClick(View v) { | |
new Thread(new Runnable() { | |
public void run() { | |
final Bitmap bitmap = loadImageFromNetwork("http://example.com/image.png"); | |
mImageView.post(new Runnable() { | |
public void run() { | |
mImageView.setImageBitmap(bitmap); | |
} | |
}); | |
} | |
}).start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment