Created
January 18, 2015 16:09
-
-
Save Dnile/df0aa773806d0934ab6e to your computer and use it in GitHub Desktop.
android http get with okhttp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String url = "http://api.openweathermap.org/data/2.5/weather?q=London,uk"; | |
OkHttpClient client = new OkHttpClient(); | |
try{ | |
Request request = new Request.Builder() | |
.url(url) | |
.build(); | |
Response response = client.newCall(request).execute(); | |
System.out.println(response.body().string()); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment