java Android - volley library - get a Bitmap via ImageLoader

只愿长相守 提交于 2020-01-01 11:58:09

问题


I'm doing some examples with volley library for which there is so few docs/examples

public class MainActivity extends Activity {
    private ImageView mImageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mImageView=(ImageView) findViewById(R.id.imageView1);
        RequestQueue queue = Volley.newRequestQueue(this); 
        ImageLoader imageLoader = new ImageLoader(queue,new BitmapLruCache());
        imageLoader.get("http://s017.radikal.ru/i413/1209/e7/648aa22cb947.jpg", ImageLoader.getImageListener(mImageView, R.drawable.ic_launcher, R.drawable.ic_launcher));
    }

This loads an Image from the url directly into ImageView. But what if I want to crop it before put it on an ImageView?

Can this ImageLoader place image to a Bitmap somehow?


回答1:


Do you wanna this?

   imageLoader.get(newsItem.getThumbUrl(), new ImageLoader.ImageListener() {
        @Override
        public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) {

        }

        @Override
        public void onErrorResponse(VolleyError error) {

        }
    });


来源:https://stackoverflow.com/questions/18292695/java-android-volley-library-get-a-bitmap-via-imageloader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!