我正在尝试使用https
和RequestQueue
进行一个简单的Volley
请求,但它只是不执行该请求。
代码附在下面:
RequestQueue queue = Volley.newRequestQueue(this);
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.
System.out.println("ggg:"+response);
if (response.contains("HERE")) {
Toast.makeText(getApplicationContext(), "Logged in successfully!", Toast.LENGTH_LONG).show();
Intent in = new Intent(getApplicationContext(), ImportContactsActivity.class);
startActivity(in);
} else if (response.contains("OK")) {
Toast.makeText(getApplicationContext(), "Not", Toast.LENGTH_LONG).show();
} else if (response.contains("logoff")) {
Toast.makeText(getApplicationContext(), "Please log off your old device to login.", Toast.LENGTH_LONG).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//sSystem.out.println("bla: "+error);
}
});
queue.add(stringRequest);