@@ -0,0 +1,2945 @@
+import android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0Aimport android.os.AsyncTask;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.net.HttpURLConnection;%0Aimport java.net.URL;%0A%0Apublic class ImageDownloader extends AsyncTask%3CString, Void, Boolean%3E %7B%0A    private Bitmap mBitmap;%0A%0A    //The minimum required height and width%0A    private final static int REQUIRED_WIDTH = 102, REQUIRED_HEIGHT = 102;%0A%0A    @Override%0A    public Boolean doInBackground(String... params) %7B%0A        mBitmap = null;%0A        try %7B%0A            URL url = new URL(params%5B0%5D);%0A            HttpURLConnection connection_size = (HttpURLConnection) url.openConnection();%0A            connection_size.setDoInput(true);%0A            connection_size.connect();%0A            HttpURLConnection connection_image = (HttpURLConnection) url.openConnection();%0A            connection_image.setDoInput(true);%0A            connection_image.connect();%0A%0A            mBitmap = decodeSampledBitmapFromStream(%0A                    connection_size.getInputStream(),%0A                    connection_image.getInputStream(),%0A                    REQUIRED_WIDTH, REQUIRED_HEIGHT);%0A            return mBitmap != null;%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    protected void onPostExecute(Boolean success) %7B%0A        super.onPostExecute(success);%0A%0A        if (success) %7B%0A            /**%0A             * TODO%0A             * Do something with mBitmap, such as notifying the class%0A             * that called this task and giving it mBitmap.%0A             */%0A        %7D%0A    %7D%0A%0A    public static Bitmap decodeSampledBitmapFromStream(InputStream is_size, InputStream is_image, int reqWidth, int reqHeight) %7B%0A        BitmapFactory.Options options = new BitmapFactory.Options();%0A        options.inJustDecodeBounds = true;%0A        BitmapFactory.decodeStream(is_size, null, options);%0A%0A        options.inSampleSize = calculateInSampleSize(options.outWidth, options.outHeight, reqWidth, reqHeight);%0A        options.inJustDecodeBounds = false;%0A%0A        return BitmapFactory.decodeStream(is_image, null, options);%0A    %7D%0A%0A    //From http://developer.android.com/training/displaying-bitmaps/load-bitmap.html%0A    public static int calculateInSampleSize(int width, int height, int reqWidth, int reqHeight) %7B%0A        // Raw height and width of image%0A        int inSampleSize = 1;%0A%0A        if (height %3E reqHeight %7C%7C width %3E reqWidth) %7B%0A%0A            final int halfHeight = height / 2;%0A            final int halfWidth = width / 2;%0A%0A            // Calculate the largest inSampleSize value that is a power of 2 and keeps both%0A            // height and width larger than the requested height and width.%0A            while ((halfHeight / inSampleSize) %3E reqHeight%0A                    && (halfWidth / inSampleSize) %3E reqWidth) %7B%0A                inSampleSize *= 2;%0A            %7D%0A        %7D%0A%0A        return inSampleSize;%0A    %7D%0A%7D%0A

Create ImageDownloader.java