Search code examples
androidandroid-volleynetworkimageview

android - rounded NetwrokImageView


I am working with volley library to extract image URLs from server which are square in shape. I want to display it in Round shape.

In volley library I am setting image in NetworkImageView like :

profilepic.setImageUrl(imgURL, imageLoader);

Solution

  • you can also use simple image view for that

      ImageLoader imageLoader = AppController.getInstance().getImageLoader();
     // If you are using normal ImageView
     imageLoader.get(Const.URL_IMAGE, new ImageListener() {
    
    @Override
    public void onErrorResponse(VolleyError error) {
        Log.e(TAG, "Image Load Error: " + error.getMessage());
    }
    
    @Override
    public void onResponse(ImageContainer response, boolean arg1) {
        if (response.getBitmap() != null) {
            // load image into imageview
            imageView.setImageBitmap(response.getBitmap());
        }
      }
    });
    

    and now you can round your image view by using any library avaliable on github

    one of the library that i mostly use

    https://github.com/Pkmmte/CircularImageView