mdsami / android-query

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

Allow to use Async call as a standard AsyncTask replacement #114

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Please add async method, which allow to start AjaxCallback where the result is 
not loaded from network, but is computed localy. This will be very handy for 
time consuming operations as a standard AsyncTask replacement. Simply allow to 
implement our own background work :-)

Original issue reported on code.google.com by vladisla...@bioport.cz on 8 Jan 2013 at 8:14

GoogleCodeExporter commented 8 years ago
Wanted this myself couple times. Should be easy enough to add.

Original comment by tinyeeliu@gmail.com on 9 Jan 2013 at 7:21

GoogleCodeExporter commented 8 years ago
This is my workaround for this problem:

bmp = aq.getCachedImage(url2); 
if (bmp != null) { // if image is cached already
    (new AjaxCallbackLoadingBitmap()).callback(url2, bmp, new AjaxStatus());
} else { // if image is not cached yet
    //Log.d(TAG, "Not Cached: "+iconUrl);
    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);
}

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