这是我的审核代码,我无法解决此错误。我生成的值是附加十六进制数, normal , null ....
Map Api Url 0x22cd051c NORMAL null
GetDirectionActivity.java
public class GetDirectionActivity extends Activity implements TextWatcher,
Response.Listener<JSONObject>, Response.ErrorListener {
String url;
private static final String TAG_RESULT = "predictions";
JSONObject json;
AutoCompleteTextView actvGDOrigin;
ArrayList<String> names;
ArrayAdapter<String> adapter;
String browserKey = "AIzaSyAJKpL6YNyhf_bhoZMk5exe2lJc8Sm7L6M";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_get_direction);
actvGDOrigin = (AutoCompleteTextView) findViewById(R.id.actvGDOrigin);
actvGDOrigin.setThreshold(3);
names = new ArrayList<String>();
actvGDOrigin.addTextChangedListener(this);
}
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 + "&sensor=false&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");
}
public void onResponse(JSONObject response) {
try {
JSONArray ja = response.getJSONArray(TAG_RESULT);
for (int i = 0; i < ja.length(); i++) {
JSONObject c = ja.getJSONObject(i);
String description = c.getString("description");
Log.d("description", description);
names.add(description);
}
adapter = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1, names) {
@Override
public View getView(int position, View convertView,
ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView text = (TextView) view
.findViewById(android.R.id.text1);
text.setTextColor(Color.BLACK);
return view;
}
};
actvGDOrigin.setAdapter(adapter);
adapter.notifyDataSetChanged();
} catch (Exception e) {
}
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
if (s.toString().length() <= 3) {
names = new ArrayList<String>();
updateList(s.toString());
}
}
@Override
public void onErrorResponse(VolleyError arg0) {
// TODO Auto-generated method stub
}
}
RouteViaApp.java
public class RouteViaApp extends Application {
private RequestQueue mRequestQueue;
private static RouteViaApp mInstance;
public static final String TAG = RouteViaApp.class
.getSimpleName();
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized RouteViaApp getInstance() {
return mInstance;
}
public RequestQueue getReqQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToReqQueue(Request<T> req, String tag) {
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getReqQueue().add(req);
}
public <T> void addToReqQueue(Request<T> req) {
req.setTag(TAG);
getReqQueue().add(req);
}
public void cancelPendingReq(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}
CustomJSONObjectRequest.java
public class CustomJSONObjectRequest extends JsonObjectRequest {
public CustomJSONObjectRequest(int method, String url, JSONObject jsonRequest,
Response.Listener<JSONObject> listener,
Response.ErrorListener errorListener) {
super(method, url, jsonRequest, listener, errorListener);
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=utf-8");
return headers;
}
@Override
public RetryPolicy getRetryPolicy() {
// here you can write a custom retry policy
return super.getRetryPolicy();
}
}