Hi i want to display a webpage in the using http connection..am new to
android and java ....so any one can give me guiadance how i can make this...
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setTitle("Fund Projects");
try {
URL url = new URL(directoryLocation);
HttpURLConnection httpURLConnection = (HttpURLConnection) url
.openConnection();
// The line below is where the exception is called
int response =
httpURLConnection.getResponseCode();
if (response == HttpURLConnection.HTTP_OK) {
// Response successful
InputStream inputStream = httpURLConnection.getInputStream();
// Parse it line by line
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(inputStream));
String temp;
while ((temp = bufferedReader.readLine()) != null) {
// Parsing of data here
}
} else {
Log.e("SAMES", "INCORRECT RETURN CODE: " + response);
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en