Skip to content

Instantly share code, notes, and snippets.

@jhelmig
Created January 3, 2014 01:33
Show Gist options
  • Select an option

  • Save jhelmig/8230927 to your computer and use it in GitHub Desktop.

Select an option

Save jhelmig/8230927 to your computer and use it in GitHub Desktop.
@Override
protected String doInBackground(String... params) {
String urlString=params[0]; // URL to call
String resultToDisplay = "";
InputStream in = null;
// HTTP Get
try {
URL url = new URL(urlString);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
in = new BufferedInputStream(urlConnection.getInputStream());
} catch (Exception e ) {
System.out.println(e.getMessage());
return e.getMessage();
}
return resultToDisplay;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment