我的代码:
private TextView mTextMessage;
RequestQueue queue = Volley.newRequestQueue(this);
String url ="http://www.google.com";
// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Display the first 500 characters of the response string.
mTextMessage.setText("Response is: "+ response.substring(0,500));
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextMessage.setText("That didn't work!");
}
});
// Add the request to the RequestQueue.
queue.start();
我引用此文件。 https://developer.android.com/training/volley/requestqueue
错误消息是
queue.start(); error: <identifier> expected
。
为什么?