Good evening, you need to send a request to the server and put the following in the header.

Authorization: Bearer rsNQgkedqLca

where rsNQgkedqLca is a token.

How I try to solve this problem:

@GET("/get-free-request-count") Call<Count> getCount(@Header("Authorization") String token); Call<Count> call = (Call<Count>) mServerApi.getCount("Bearer " + mToken); call.enqueue(new Callback<Count>() { @Override public void onResponse(Call<Count> call, Response<Count> response) { if (response.body().getmCount().equals("2")) { Toast.makeText(getApplicationContext(), "У вас осталось: " + response.body().getmCount(), Toast.LENGTH_LONG); 

What am I doing wrong?

java.lang.

  • one
    You do everything right. Or maybe not. But how do we know if you don’t tell you how your attempts end ... - YuriiSPb
  • @ YuriSPb here, updated. - Martinez Toni
  • According to your error, your response.body() null . Try to display the response (or its internal parts) as a line - maybe there is some useful info there - YuriySPb
  • @Yuriy SPb is nothing) - Martinez Toni
  • @ ЮрийСПб and what should I do? - Martinez Toni

0