I have a request
public void onResponse(Call<Count> call, Response<Count> response) { Log.d("Response", String.valueOf(response.code())); if (response.body().getmCount().equals("2")) { Toast.makeText(getApplicationContext(), "У вас осталось: " + response.body().getmCount(), Toast.LENGTH_LONG); } else if (response.body().getmCount().equals("1")) { Toast.makeText(getApplicationContext(), "У вас осталось: " + response.body().getmCount(), Toast.LENGTH_LONG); } else if (response.body().getmCount().equals("0")){ Toast.makeText(getApplicationContext(),"У вас осталось: "+response.body().getmCount(),Toast.LENGTH_LONG); mCount = 0; } } @Override public void onFailure(Call<Count> call, Throwable t) { } });
But I have an error from server 401, with this error I need to send a new request, how to do it?
onFailure
, depending on the responce code - Vladyslav Matviienko