Created
November 22, 2013 11:44
-
-
Save devloe/7598633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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