Android 使用volley jar访问google place API
我在传递Android 使用volley jar访问google place API,android,google-maps-api-3,google-api,android-volley,android-googleapiclient,Android,Google Maps Api 3,Google Api,Android Volley,Android Googleapiclient,我在传递DataRequest时出错,同时又生成了–3个字符串–0x22cd051c NORMAL null------十六进制、NORMAL和null我得到了为什么它们被附加到URL datarequest.java public DataRequest(int method, String url, Map<String, String> params, Listener<JSONObject> reponseListener, ErrorLi
DataRequest
时出错,同时又生成了–3个字符串–0x22cd051c NORMAL null------十六进制、NORMAL和null我得到了为什么它们被附加到URL
datarequest.java
public DataRequest(int method, String url, Map<String, String> params,
Listener<JSONObject> reponseListener, ErrorListener errorListener) {
super(method, url, errorListener);
Log.i("url", url);
this.listener = reponseListener;
this.params = params;
this.errorListener = errorListener;
}
MainActivity
public void updateList(String place) {
String input = "";
try {
input = "input=" + URLEncoder.encode(place, "utf-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
String output = "json";
String parameter = input + "&types=geocode&sensor=true&key="
+ browserKey;
url = "https://maps.googleapis.com/maps/api/place/autocomplete/"
+ output + "?" + parameter;
Log.d("url", url);
DataRequest dataRequest = new DataRequest(Method.GET, url, null, this, this);
Log.d("datarequest:",dataRequest.toString());
RouteViaApp.getInstance().addToReqQueue(dataRequest, "jreq");
}
公共数据请求(int方法、字符串url、映射参数、,
侦听器reposeListener,ErrorListener ErrorListener){
super(方法、url、errorListener);
Log.i(“url”,url);
this.listener=reponlistener;
this.params=params;
this.errorListener=errorListener;
}
主要活动
公共无效更新列表(字符串位置){
字符串输入=”;
试一试{
input=“input=“+urlcoder.encode(放置“utf-8”);
}捕获(不支持DencodingException e1){
e1.printStackTrace();
}
字符串输出=“json”;
字符串参数=输入+“&types=geocode&sensor=true&key=”
+浏览器键;
url=”https://maps.googleapis.com/maps/api/place/autocomplete/"
+输出+“?”+参数;
Log.d(“url”,url);
DataRequest DataRequest=新的DataRequest(Method.GET,url,null,this,this);
Log.d(“datarequest:,datarequest.toString());
RouteViaApp.getInstance().addToReqQueue(dataRequest,“jreq”);
}
似乎您的API密钥已过期…但每个API都显示相同的消息您的API密钥已过期…但每个API都显示相同的消息