Android Can't compress a recycled bitmap : I'm getting an image from a URL, I want to compress it and save it in the external memory device. I get this error

   

      java.lang.IllegalStateException: 
        Can't compress a recycled bitmap
        at android.graphics.Bitmap.checkRecycled(Bitmap.java:400)
        at android.graphics.Bitmap.compress(Bitmap.java:1307)

at this line

     mIcon11.compress(Bitmap.CompressFormat.JPEG, 40, bytes);


---------------------------------------------------------------------

    String foto = UT_drive_dropbox.AM.getfoto();
    Bitmap mIcon11 = null;
        try {
            InputStream in = new java.net.URL(foto).openStream();
            mIcon11 = BitmapFactory.decodeStream(in);
        } catch (Exception e) {
            Log.e("Error", e.getMessage());
            e.printStackTrace();
        }
    final Bitmap output = Bitmap.createBitmap(mIcon11.getWidth(),
                mIcon11.getHeight(), Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(output);

        final int color = Color.RED;
        final Paint paint = new Paint();
        final Rect rect = new Rect(0, 0, mIcon11.getWidth(), mIcon11.getHeight());
        final RectF rectF = new RectF(rect);

        paint.setAntiAlias(true);
        canvas.drawARGB(0, 0, 0, 0);
        paint.setColor(color);
        canvas.drawOval(rectF, paint);

        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(mIcon11, rect, rect, paint);

        mIcon11.recycle();


        String fileName = "avatar.jpg";
        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
         mIcon11.compress(Bitmap.CompressFormat.JPEG, 40, bytes);

        File sd = new File(Environment.getExternalStorageDirectory(), getString(R.string.app_name) + File.separator + fileName);

        FileOutputStream fileOutputStream = null;
        try {
            sd.createNewFile();
            fileOutputStream = new FileOutputStream(sd);
            fileOutputStream.write(bytes.toByteArray());

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (fileOutputStream != null) {
                try {
                    fileOutputStream.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
                                                     