TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
vetriselvan vetri
NA
28
8k
java.net.UnknownHostException:
May 4 2015 12:03 AM
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
;
}
}
Reply
Answers (
0
)
Hybrid Mobile PDF Opening
how to draw a line with various thickness for speed drawing