Simple Android Volley login request
You can use a variable and assume that it will fail, if you do not print the new message

   public void login(View view){
            RequestQueue queue = Volley.newRequestQueue(this);
            String URL = "http://10.0.2.2:8000/api/login";
            StringRequest request = new StringRequest(Request.Method.POST, URL,
                    new Response.Listener&lt;String&gt;()
                    {
                        @Override
                        public void onResponse(String response) {
                            String loginMsg = "Ooops something is not correct !";

                            try {
                                JSONObject jsonObj = new JSONObject(response);
                                myToken =jsonObj.getString("token");
                                if (myToken != ""){
                                    loginMsg = "Login successfull !"
                                }
                            } catch (JSONException e) {
                                 myToken = "";    
                                 e.printStackTrace();
                            }

                            Toast.makeText(getApplicationContext(), loginMsg, Toast.LENGTH_LONG).show();

                        }
                    },
                    new Response.ErrorListener()
                        {
                        @Override
                        public void onErrorResponse(VolleyError error) {
                            myToken = "";
                            Toast.makeText(getApplicationContext(), "Ooops something is not correct !", Toast.LENGTH_LONG).show();
                            NetworkResponse response = error.networkResponse;
                            String errorMsg = "";
                            if(response != null &amp;&amp; response.data != null){
                                String errorString = new String(response.data);
                            }
                        }
                    }
            ) {
                @Override
                protected Map&lt;String, String&gt; getParams()
                {
                    Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                    TextInputEditText mail = findViewById(R.id.textInputEditTextEmail);
                    TextInputEditText pw = findViewById(R.id.textInputEditTextPassword);
                    params.put("email", mail.getText().toString());
                    params.put("password", pw.getText().toString());
                    return params;
                }
            };
            queue.add(request);
        }