Skip to content

Instantly share code, notes, and snippets.

@FlaviusPopescu
Created April 28, 2016 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlaviusPopescu/381766d26c5002b2d0e94b167e166e11 to your computer and use it in GitHub Desktop.
Save FlaviusPopescu/381766d26c5002b2d0e94b167e166e11 to your computer and use it in GitHub Desktop.
Internet and Background Tasks
public class MainActivity extends AppCompatActivity {
final String IMAGE_URL = "https://pixabay.com/static/uploads/photo/2014/12/22/00/05/spindle-576757_960_720.png";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ImageView imageView = (ImageView) findViewById(R.id.headerimage);
new ImageDownloaderTask(new ImageDownloaderTask.OnImageDownloadedListener() {
@Override
public void onImageDownloaded(Bitmap bitmap) {
imageView.setImageBitmap(bitmap);
}
}).execute(IMAGE_URL);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment