java - 所有键和值都必须为非空
问题描述
2021-08-13 14:28:10.414 5005-5092/com.nigoote.peaplesafetyapp E/Volley: [304] NetworkDispatcher.processRequest: 未处理的异常 java.lang.IllegalArgumentException: Request#getParams() 或 Request#getPostParams() 返回包含 null 键或值的映射:(firstname, null)。所有键和值都必须为非空。java.lang.IllegalArgumentException:Request#getParams() 或 Request#getPostParams() 返回了一个包含空键或值的映射:(firstname, null)。所有键和值都必须为非空
这是我得到的错误,导致错误的代码如下:
RequestQueue requestQueue = Volley.newRequestQueue(CreateNewAcount.this);
StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (response.equals("Successfully_Registered")){
Log.d("enock",response+"working");
progressDialog.dismiss();```
Toast.makeText(CreateNewAcount.this, response, Toast.LENGTH_SHORT).show();
startActivity(new Intent(CreateNewAcount.this,LoginActivity.class));
finish();
}else{
progressDialog.dismiss();
Toast.makeText(CreateNewAcount.this, response, Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
progressDialog.dismiss();
Toast.makeText(CreateNewAcount.this, error.toString(), Toast.LENGTH_SHORT).show();
}
}){ ```
in HahMap the firstname is not null but i don't konw why i get this error
``` @Nullable
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> param = new HashMap<String, String>();
param.put("firstname",fname);
param.put("lastname",lname);
param.put("phonenumber",phone);
param.put("password",password1);
param.put("address",address);
param.put("allergy",allergy);
return param;
}
};
请我不知道如何解决它的帮助。
解决方案
推荐阅读
- jsf - 使用 onclick 事件捕获数据表中单元格的值 -primefaces
- gitlab - Gitlab:如何向请求访问的用户发送消息
- c# - Check if a file is directory in UWP
- azure-machine-learning-studio - 如何在 Azure 机器学习中限制请求参数
- python - 程序跳过列表元素
- python - 将值分配给图像数组的随机块的有效方法?
- java - 如何在java中的坐标数组中找到左上角坐标
- c# - Instantiate the next item when the first item is dropped
- python - My python code that converts numbers between bases has several errors. What could be wrong and how can I find them?
- python - Python - Pivot and create histograms from Pandas column, with missing values