Skip to content

Instantly share code, notes, and snippets.

@tommybuonomo
Created July 5, 2017 21:54
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 tommybuonomo/d899993a9e6c88984a72023c329cb6b6 to your computer and use it in GitHub Desktop.
Save tommybuonomo/d899993a9e6c88984a72023c329cb6b6 to your computer and use it in GitHub Desktop.
HttpURLConnection urlConnection = null;
try {
URL url = new URL("https://www.android.com/");
urlConnection = (HttpURLConnection) url.openConnection();
return readInputStream(urlConnection.getInputStream());
} catch (IOException e) {
e.printStackTrace();
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
}
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment