0

i wanted to know that how to compress the size of bitmap in volley

when i try to compress then then the image will not displaying

i have try this

  mImageLoader.get(imageUrl, new ImageLoader.ImageListener() {
                    @Override
                    public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {
                        Bitmap bm = response.getBitmap();
                        bm.compress(CompressFormat.PNG, 70, null);

                        imageViewLoad.setImageBitmap(bm);
                    }

                    @Override
                    public void onErrorResponse(VolleyError error) {

                    }
                });
Mahtab
  • 269
  • 3
  • 11
  • What are you trying to do? To display a bitmap you need it in uncompressed format. – Henry May 03 '16 at 06:27
  • i was trying to do it in on response, actually when i try to display bitmap in my image it is taking few sec and i dont want this thats why i wanted to compress the size of bitmap – Mahtab May 03 '16 at 06:32
  • http://stackoverflow.com/questions/8417034/how-to-make-bitmap-compress-without-change-the-bitmap-size – BNK May 03 '16 at 07:10
  • try this method............ public String getStringImage(Bitmap bmp){ ByteArrayOutputStream baos = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos); byte[] imageBytes = baos.toByteArray(); String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT); return encodedImage; } and also check this tutorial https://www.simplifiedcoding.net/android-volley-tutorial-to-upload-image-to-server/ – Muhammad Waleed May 03 '16 at 07:16
  • any thing i am doing in onrespose method bitmap is not displaying – Mahtab May 03 '16 at 07:32

0 Answers0