Question

Hi I have a request URL (Google Places Request URL) and the response I get is a image. How can I get the image on callback function?

Update

AQuery aQuery = new AQuery(getApplicationContext());
String urlString = "https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRoAAAAGJs3jtWR_Dm_lQSan6ha40TR2IKPlqbLQ5-slSCxPJJIksM2GmiEhqBtmhtdu9_njLxvFMyTMz-e_FoDIZuKmoS65Uc1AeD4kWjrJ4SwEjgT4ac-KtfNaX4Lg0FOqJRCN33ylJikCF29bgqKCcNUQxIQ0OvXpGXfUT3ADICQqP_QOhoUBlByoB4FKPp1woIKVb2Z01bblrw&sensor=true&key=AIzaSyB-tx7MBOQk4qya_vnmwHlQDao-SufKuBw";

aQuery.ajax(urlString, String.class, new AjaxCallback<String>(){
    @Override
    public void callback(String url, String content, AjaxStatus 

           //Here "content" is the response that I'm getting. Currently I'm getting this as a String I don't know how to get it as a image 

    }
});
Was it helpful?

Solution

Like this:

final AjaxCallback<Bitmap> cb = new AjaxCallback<Bitmap>() {
    @Override
    public void callback(String url, Bitmap bm, AjaxStatus status) {
         // do whatever you want with bm (the image)
        }
    };
final AQuery aq = new AQuery(ctx);
aq.ajax(url, Bitmap.class, 0, cb);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top