the intent is not opening,in both conditions the default one executes.i have tried from if else statement too but got the same result : StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        //If we are getting success from server
                        switch (response) {
                            case "success": {
                                Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                                startActivity(intent);
                            }
                            default:
                                Toast.makeText(getApplicationContext(),response,Toast.LENGTH_LONG).show();
                        }

                    }