Back to project page XKCDWidget.
The source code is released under:
MIT License
If you think the Android project XKCDWidget listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * (c) 2011 Anthony Sandrin/*from w ww .j a va 2s. c o m*/ * This code is licensed under MIT license (see LICENSE.txt for details) */ package me.sandrin.xkcdwidget; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; import android.util.Log; import java.io.IOException; import java.io.InputStream; import java.net.URL; public class GetImageTask extends AsyncTask<String, Void, Bitmap> { @Override protected Bitmap doInBackground(String... params) { String imageUrl = params[0]; Bitmap image = null; try { image = BitmapFactory.decodeStream((InputStream) new URL(imageUrl).getContent()); } catch (IOException e) { Log.e("XKCD", "Unable to get XKCD image.", e); } return image; } }