Skip to content

Instantly share code, notes, and snippets.

@takuo
Created October 18, 2011 07:12
Show Gist options
  • Save takuo/1294790 to your computer and use it in GitHub Desktop.
Save takuo/1294790 to your computer and use it in GitHub Desktop.
Android code snippet - using Thread
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