Проблема в том, что ваш ответ находится в JSONArray, и вы выполняете запрос строки.
Попробуйте этот метод удара.
JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(
Request.Method.GET,
mJSONURLString,
null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray jsonArray) {
Log.d("response", response);
try {
JSONObject jsonObject = jsonArray.getJSONObject(0);
String code = jsonObject.getString("code");
if (code.equals("mail_send")) {
AlertDialog.Builder builder = new AlertDialog.Builder(Signin.this);
builder.setCancelable(false);
builder.setMessage("Password will be sent to your registered email id.");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//if user pressed "yes", then he is allowed to exit from application
dialog.cancel();
EmailText.setVisibility(View.VISIBLE);
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(Signin.this);
builder.setCancelable(false);
builder.setMessage("Email id is not registered.");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//if user pressed "yes", then he is allowed to exit from application
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error){
// Do something when error occurred
Snackbar.make(
mCLayout,
"Error...",
Snackbar.LENGTH_LONG
).show();
}
}
);