Data Post on Database. Its give Result Json Format.
{"response":"exist"}
When get Response using Retrofit Library and json Parsing using GSON .its goes on OnFailure method and its give error.
call.enqueue(new Callback<Register>() {
@Override
public void onResponse(Call<Register> call, Response<Register> response) {
if (response.body().equals("ok")){
Toast.makeText(MainActivity.this, "Registration is Successfully", Toast.LENGTH_SHORT).show();
}else if (response.body().equals("exiest")){
Toast.makeText(MainActivity.this, "Already Exiest", Toast.LENGTH_SHORT).show();
}else if(response.body().equals("error")){
Toast.makeText(MainActivity.this, "Registration Error", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Register> call, Throwable t) {
Toast.makeText(MainActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
}
});
Error is :
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
how it Resolved its Please Guide Me.