Getting UknownHostException when doing HttpGet in Android

unebjimul

New Member
Hey guys so I am getting an UknownHostException trying to do an HttpGet request. I am basically trying to get a json object online and put it into Android and parse it. The problem is how to get that .json file from the server. the server is on heroku but I hid the actual address because the info contains sensitive data. Thanks guys.\[code\]public void getHttpResponse() throws UnsupportedEncodingException, IllegalStateException, IOException, JSONException{ HttpResponse response = null; Log.i("getHttpResponse", "Right after declaring HttpResponse response"); try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); request.setURI(new URI("....herokuapp.com/paramedic_data.json")); response = client.execute(request); Log.i("Right after response = client.execute...",response.getStatusLine().toString()); } catch (URISyntaxException e) { e.printStackTrace(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(response!= null) Log.i(response.toString(), "testing response.toString()"); /* send the HttpResponse variable to the */ //populateList(response);}\[/code\]
 
Top