问题描述
- 求助各位大大,如何保存volley包里onresponse方法的返回值
-
代码如下: Volley.newRequestQueue(getApplication()); RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext()); final HashMap<String,String> map = new HashMap<String,String>(); Request js = new StringRequest(Request.Method.POST, "http://demo.giantming.net/signup.php", new Listener<String>() { @Override public void onResponse(final String response) { // TODO Auto-generated method stub new Thread(new Runnable() { public void run() { map.put("res", response); } }) .start(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }) { @Override protected HashMap<String, String> getParams() { HashMap<String, String> hp= new HashMap<String, String>(); hp.put("stuid", siid); hp.put("username", uname); hp.put("password", password); hp.put("college", simajor); return hp; } }; requestQueue.add(js); Log.e("tag", map.get("res")+""); } 好像在这个方法里除了Log之外都不能对这个返回值(即response)进行操作 放进map也不行 只能保存一个空值 用if判断也不行
解决方案
http://blog.csdn.net/findsafety/article/details/43196281
时间: 2024-11-01 21:27:04