java.net.UnknownHostException:
java.net.UnknownHostException
how can i solve the problem,
i have used internet permission in manifest.
This is my code;
hi i just trying to show details from url in a textview by sollwing method.
whenever i run the code it throw a exception "java.net.UnknownHostException"
My code is:
class Apical extends AsyncTask
{
@Override
protected Object doInBackground(Object[] params)
{
TextView textv = (TextView)findViewById(R.id.txt1);
textv.setText("Text Has Been Changed");
BufferedReader in = null;
String data = null;
try{
HttpClient httpclient = new DefaultHttpClient();
HttpGet request = new HttpGet();
URI website = new URI("url");
request.setURI(website); HttpResponse response = httpclient.execute(request);
in = new BufferedReader(new InputStreamReader( response.getEntity().getContent()));
// NEW CODE
String line = in.readLine();
textv.append(" First line: " + line);
// END OF NEW CODE
textv.append(" Connected ");
}
catch(Exception e)
{
Log.e("log_tag", "Error in http connection " + e.toString());
}
return null;
}
}