Hi i want to check json response id with user login id stored in share preference here is my json response
{"code":1,"message":"Success","result":[{"id":"1","name":"Albert Einstein","description":"Albert Einstein was a German-born theoretical physicist.","galaxy":"Cartwheel","star":"0008","dob":"1905-05-13","died":"1973-04-06"}]}
And here is where i check response body empty or not
retrievedData.enqueue(new Callback<ResponseModel>() {
@Override
public void onResponse(Call<ResponseModel> call, Response<ResponseModel>
response) {
if(response == null || response.body() == null){
showInfoDialog(ScientistsActivity.this,"ERROR","Response or Response Body is null. \n Recheck Your PHP code.");
return;
}
if(response == null || response.body() == null){
showInfoDialog(ScientistsActivity.this,"ERROR","Response or Response Body is null. \n Recheck Your PHP code.");
return;
}
List<Scientist> currentPageScientists = response.body().getResult();
if (currentPageScientists != null && currentPageScientists.size() > 0) {
if (action.equalsIgnoreCase("GET_PAGINATED_SEARCH")) {
allPagesScientists.clear();
}
allPagesScientists.addAll(currentPageScientists);
// show(ScientistsActivity.this,currentPageScientists.size()+" Scientists Found");
} else {
if (action.equalsIgnoreCase("GET_PAGINATED_SEARCH")) {
allPagesScientists.clear();
}
show(ScientistsActivity.this,"Hey! Reached End. No more Found");
}
mAdapter.notifyDataSetChanged();
hideProgressBar(mProgressBar);
}
I dont have any idea about how to do it
I think you can use Interceptor with spring boot. You can check all response with postHandle method.
You can visit this page https://www.tutorialspoint.com/spring_boot/spring_boot_interceptor.htm