Hi i want to get data from the server ...i done using http connection
but the webpage is not displaying....
am new to android and java...so plz any one can provide me guidance.
// 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();
}
}
}
Thankyou
arun
--
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