1

嗨,我有一个请求 URL(Google Places 请求 URL),我得到的响应是一张图片。如何在回调函数中获取图像?

更新

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 

    }
});
4

1 回答 1

2

像这样:

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);
于 2014-03-04T02:28:15.447 回答