Re: [android-developers] http connection to display a webpage
Hi Arun While sending an http request we cant get (display the webpage) we get a response such as xml or json , we need to parse the response and retrive th edata as needed. if u want to display the we page u can use webview. thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] http connection to display a webpage
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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en