Created
September 6, 2012 09:17
-
-
Save meadhikari/3653543 to your computer and use it in GitHub Desktop.
Android Out of Memory, How to Optimize
This file contains hidden or 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
StringBuilder response = new StringBuilder(); | |
String jsonString; | |
URL url; | |
HttpURLConnection httpconn; | |
try { | |
url = new URL("http://backend-newsinamap.appspot.com"); | |
httpconn = (HttpURLConnection) url.openConnection(); | |
if (httpconn.getResponseCode() == HttpURLConnection.HTTP_OK) | |
{ | |
BufferedReader input = new BufferedReader(new InputStreamReader(httpconn.getInputStream()),8192); | |
String strLine = null; | |
while ((strLine = input.readLine()) != null) | |
{ | |
response.append(strLine); | |
} | |
input.close(); | |
jsonString = response.toString(); | |
} | |
} catch (MalformedURLException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} catch (IOException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment