Hi I am trying to display the error messages stored in the following JSONObject obj
{"errors":["nickname is already taken,","email is already taken"]}
This is my implementation:
TextView errorMsg;
errorMsg = (TextView)findViewById(R.id.register_error);
String[] errorArray = (String[])obj.get("errors");
errorMsg.setText(errorArray[0]);
Toast.makeText(getApplicationContext(), errorArray[0], Toast.LENGTH_LONG).show();
However when trying to run the code, I get a ClassCastException
Can anyone explain to me the issue and how I can resolve it?
Thanks!