Android 未正确获取Google places结果

Android 未正确获取Google places结果,android,json,url,google-places,Android,Json,Url,Google Places,我正试图在json中获得Google places的结果。但每次我都得到了结果 请求状态被拒绝 package com.json.trial; public class GetMethodEx { String API_KEY = "My Places Key"; String baseUrl="https://maps.googleapis.com/maps/api/place/search/json?"; key="AIzaSyCQ6m78y0CLClp

我正试图在json中获得Google places的结果。但每次我都得到了结果 请求状态被拒绝

    package com.json.trial;


public class GetMethodEx {
    String API_KEY = "My Places Key";

    String baseUrl="https://maps.googleapis.com/maps/api/place/search/json?";
    key="AIzaSyCQ6m78y0CLClpvldSwY-aI2JbbZGoFx68";
    double latitude,longitude;

    public String getInternetData()throws Exception{

        latitude=-33.8670522;
        longitude=151.1957362;

        GenericUrl reqUrl = new GenericUrl(baseUrl);

         reqUrl.put("location", Double.toString(latitude) + "," + Double.toString(longitude));
        reqUrl.put("radius", 500);
        reqUrl.put("types", "");
        reqUrl.put("sensor", "false");
        reqUrl.put("key", API_KEY);

        BufferedReader in = null;
        String data = null;
        try{
            HttpClient client = new DefaultHttpClient();
            URI website = new URI (baseUrl);
            HttpGet request = new HttpGet();
            request.setURI(website);
            HttpResponse response = client.execute(request);
            in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
            StringBuffer sb = new StringBuffer("");
            String l="";
            String nl = System.getProperty("line.separator");

            while((l=in.readLine())!= null){
                sb.append(l + nl);
            }
            in.close();
            data = sb.toString();
            return data;
        }finally{
            if(in!=null){
                try{
                    in.close();
                    return data;
                }catch(Exception e){
                    e.printStackTrace();
                }
            }
        }


    }
}

您没有在中传递
reqUrl

URI website = new URI (baseUrl);
试试这个:

URI website = new URI (reqUrl);

我试过学校和食物类型我试过这个,如果你直接在一行中输入特定纬度和经度的url,它就工作了…但是当我以上面的方式提供url时..它只是空结果和请求状态被拒绝看到上面的代码..你能告诉我我提供的方式吗从CurrentLocation类到main类的纬度和经度是否良好..顺便说一句,谢谢你的回复…同时我会尝试一下并让你知道..谢谢你的回复..我已经完成了你告诉的…但仍然没有帮助。但我发现了我的问题并解决了。请分享,你的解决方案是什么?