Skip to content

Instantly share code, notes, and snippets.

@Dnile
Created January 18, 2015 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dnile/df0aa773806d0934ab6e to your computer and use it in GitHub Desktop.
Save Dnile/df0aa773806d0934ab6e to your computer and use it in GitHub Desktop.
android http get with okhttp
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