Skip to content

Instantly share code, notes, and snippets.

@devloe
Created November 22, 2013 11:44
Show Gist options
  • Save devloe/7598633 to your computer and use it in GitHub Desktop.
Save devloe/7598633 to your computer and use it in GitHub Desktop.
public static void connect(String url)
{
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://192.168.1.36/breves/_beta/public/" + url);
HttpResponse response;
try {
response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
String result = IOUtils.toString(instream, "UTF-8");
Log.i("Praeda",result);
JSONObject json = new JSONObject(result);
JSONArray nameArray = json.names();
JSONArray valArray = json.toJSONArray(nameArray);
return json;
instream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment