Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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