I\'m using Android Studio, and I\'ve spent a few hours trying to do a simple HTTP request in my MainActivity.java file, and tried multiple ways, and seen many web pages on t
You can use dependency for making HTTP requests or HTTPS request,Use OkHttp
Visit :https://square.github.io/okhttp
OkHttpClient client = new OkHttpClient();
String run(String url) throws IOException {
Request request = new Request.Builder()
.url(url)
.build();
try (Response response = client.newCall(request).execute()) {
return response.body().string();
}
}