Skip to content

Instantly share code, notes, and snippets.

@tleyden
Created March 18, 2015 20:16
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 tleyden/159e762e90439a09795a to your computer and use it in GitHub Desktop.
Save tleyden/159e762e90439a09795a to your computer and use it in GitHub Desktop.
new Thread(new Runnable() {
@Override
public void run() {
try {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://10.0.3.2:8080/longpoll");
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
Log.i(Application.TAG, line);
}
Log.i(Application.TAG, "Done reading response");
} catch (Exception e) {
Log.e(Database.TAG, "Error", e);
}
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment