maomy / android-query

Automatically exported from code.google.com/p/android-query
0 stars 0 forks source link

Using BitmapAjaxCallback without any ImageView #120

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Right now BitmapAjaxCallback needed to be used with ImageView only.
I want mainly following feature of BitmapAjaxCallback without associating it 
with any ImageView
   1: Get Bitmap
   2: Use filecache
   3: Use downsampling

Or normal AjaxCallback with Bitmap.class does all this work
So it is possible  

Original issue reported on code.google.com by sant...@braindigit.com on 5 Feb 2013 at 8:17

GoogleCodeExporter commented 9 years ago
Yes it is for example:

    AjaxCallback<Bitmap> cbBmp = new AjaxCallbackLoadingBitmap();
    cbBmp.url(url).type(Bitmap.class).header("User-Agent", appPrefs.getUserAgent()).expire(GlobalVars.BROCHURES_EXPIRE).fileCache(true).memCache(false);
    aq.ajax(cbBmp);

    private class AjaxCallbackLoadingBitmap extends AjaxCallback<Bitmap> {

        AjaxCallbackLoadingBitmap() {
            super();
        }

        @Override
        public void callback(String url, Bitmap bitmap, AjaxStatus status) {
            if (null != bitmap) {

                // resize your BMP here

            } else {
                Log.e(TAG,"Error load bitmap");
            }
        }
    };

Original comment by darck...@gmail.com on 27 Mar 2013 at 3:15