1

I'm trying to retrieve a Bitmap image from a URL using Android Query. However I'm left with no Bitmap whatsoever. This is my code:

    Bitmap.Config conf = Bitmap.Config.ARGB_8888;
    private int w = 700, h = 480;
    private Bitmap bmp = Bitmap.createBitmap(w, h, conf); // this creates a MUTABLE bitmap
    private AQuery aq;
    final ArrayList<Bitmap> bbf = new ArrayList<Bitmap>();
    aq = new AQuery(LookBookFlipActivity.this);

    aq.ajax("http://www.newyorker.com/wp-content/uploads/2014/08/Stokes-Hello-Kitty2-1200.jpg",Bitmap.class,0,new AjaxCallback<Bitmap>(){
    @Override
    public void callback(String url, Bitmap object, AjaxStatus status) {
        if(object != null)
        {
            bmp = object;
            bbf.add(bmp);
        }
    }
 });

And when I print out the ArrayList bbf's size, it returns zero which means either the bitmap isnt properly saved in the bmp variable or its not getting added to the arraylist. Help me out please :)

0 Answers0