I was following a tutorial and I got to a point where a lot of the code is deprecated.
ArrayList dataToSend = new ArrayList<>();
d
You should try Retrofit, it's more simple to use that library instead of perform http requests. It was made for simplify communication between java and REST API.
square.github.io/retrofit/
I give you a sample from the documentation
public interface GitHubService {
@GET("/users/{user}/repos")
List listRepos(@Path("user") String user);
}
The RestAdapter class generates an implementation of the GitHubService interface.
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.github.com")
.build();
GitHubService service = restAdapter.create(GitHubService.class);
Each call on the generated GitHubService makes an HTTP request to the remote webserver.
List repos = service.listRepos("octocat");