Home » Android » Android Volley : ImageRequest deprecated

Android Volley : ImageRequest deprecated

Posted by: admin June 15, 2020 Leave a comment


I’m on Android Studio version 1.4. I’m using the Android Volley library (I use the mcxiaoke mirror here). But the ImageRequest is deprecated. The code still works but deprecated. Has anyone found an alternative for this?

I’ve search for this issue in Google but didn’t find any solution.

Screenshot 1

How to&Answers:

I think the class is not deprecated but the constructor that you are using is deprecated.

use this constructor instead of this one

Usage example :

ImageRequest request = new ImageRequest(
                             url, myResponseListener, maxWidth,
                             maxHeight, scaleType, Config.RGB_565, myErrorListener);


I’ve used Square’s Picaso library as an alternative. It works well; you can check it out at http://square.github.io/picasso/.


 button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            final ImageRequest imageRequest=new ImageRequest (url, new Response.Listener<Bitmap>() {
                public void onResponse(Bitmap response) {

            },0,0, ImageView.ScaleType.CENTER_CROP,null, new Response.ErrorListener() {
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(MainActivity.this,"Some Thing Goes Wrong",Toast.LENGTH_SHORT).show();

            });emphasized text