Android Volley: deprecated ImageRequest

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

I searched this problem on Google but could not find a solution.

Screen shot 1

+7
android deprecated android-volley
source share
3 answers

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

use this constructor instead one

Usage example:

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

I used the Square Picaso library as an alternative. This works well; you can check it out at http://square.imtqy.com/picasso/ .

0
source share
  button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final ImageRequest imageRequest=new ImageRequest (url, new Response.Listener<Bitmap>() { @Override public void onResponse(Bitmap response) { imageView.setImageBitmap(response); } },0,0, ImageView.ScaleType.CENTER_CROP,null, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(MainActivity.this,"Some Thing Goes Wrong",Toast.LENGTH_SHORT).show(); error.printStackTrace(); } });emphasized text 
0
source share

All Articles