Home > Blockchain >  The response code or the response body, it gives me null
The response code or the response body, it gives me null

Time:10-02

I am developing a mobile application in java. And I'm trying to get a json response from the free JSONplaceholder service. I have already tried a hundred ways such as OkHttp, HttpURLConnection and so on. And when I try to get the response code or the response body, it gives me null. Please, help. Perhaps this screenshot will help to understand what the problem is.

CodePudding user response:

The problem was solved by setting the policy.

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
  • Related