我想从此活动开始一项新活动.但它在显示";成功";.我没有'I don’我不知道;这段代码有


private void register(final String name, final String city, final String bloodgroup, final String password, final String mobileno)
{
StringRequest stringRequest =  new 
StringRequest(Request.Method.POST,Endpoints.register_url,new
Response.Listener<String>(){
@Override
public void onResponse(String response) {
if (response.equals("Success")){
Toast.makeText(RegisterActivity.this, response, Toast.LENGTH_SHORT).show();
startActivity (new Intent (RegisterActivity.this, MainActivity.class));
finish ();
}else{
Toast.makeText(RegisterActivity.this, response, Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(RegisterActivity.this, "Something went wrong :(", Toast.LENGTH_SHORT).show();
Log.d("VOLLEY",error.getMessage());
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
params.put("name", name);
params.put("city", city);
params.put("bloodgroup", bloodgroup);
params.put("password", password);
params.put("number", mobileno);
return params;
}
};
VolleySingleton.getInstance(this).addToRequestQueue(stringRequest);
}

我想从此活动开始一项新活动。但它在展示"成功"之后就没有出现了。我不知道这段代码有什么问题。

尝试删除finish () ;

我希望它能对你起作用。

最新更新