private void volley_Post() { String url = "http://apis.juhe.cn/mobile/get?"; StringRequest request = new StringRequest(Method.POST, url, new Listener<String>() { @Override public void onResponse(String arg0) { Toast.makeText(MainActivity.this, "調用成功", Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { Toast.makeText(MainActivity.this, "《《《《《《《《錯誤", Toast.LENGTH_LONG).show(); } }) { @Override protected Map<String, String> getParams() throws AuthFailureError { HashMap<String, String> map = new HashMap<String, String>(); map.put("phone", "13666666666"); map.put("key", "335adcc4e891ba4e4be6d7534fd54c5d"); return map; } }; request.setTag("abcPost"); Volley.newRequestQueue(getApplicationContext()).add(request); } private void volley_Get() { String url = "http://apis.juhe.cn/mobile/get?phone=13666666666&key=335adcc4e891ba4e4be6d7534fd54c5d"; StringRequest request = new StringRequest(Method.GET, url, new Listener<String>() { @Override public void onResponse(String arg0) { Toast.makeText(MainActivity.this, arg0, Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { Toast.makeText(MainActivity.this, "調用錯誤", Toast.LENGTH_LONG).show(); } }); request.setTag("abcGet"); Volley.newRequestQueue(getApplicationContext()).add(request); }