我想从带有id排球库的服务器获取数据,然后在使用的回收站视图中显示结果。
我可以将ID发送到服务器,但无法在我的应用中显示ID为的数据 这是我的代码:
private void getData()
{
String url ="MY URL";
final ProgressDialog progressDialog = new ProgressDialog(CompanyListActivity.this);
progressDialog.setMessage("send data");
progressDialog.show();
Response.Listener<String> listener = new Response.Listener<String>()
{
@Override
public void onResponse(String response)
{
Toast.makeText(CompanyListActivity.this, "OK", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
};
Response.ErrorListener errorListener = new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
Toast.makeText(CompanyListActivity.this, error.getMessage(), Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
};
StringRequest request = new StringRequest(Request.Method.POST,url,listener,errorListener)
{
@Override
protected Map<String, String> getParams() throws AuthFailureError
{
HashMap<String ,String> map =new HashMap<>();
map.put("id","7");
return map;
}
};
MySingleton.getInstance(getApplicationContext()).addToRequestQueue(request);
}