[android-developers] How to load web page in background
How to load web page in background ? As part of my application, Im supposed to present a web-page to the user. The webpage is about .5M (has lot of images and js), so i cant fire an activity, as user has to see the page loading for considerable amount of time, if user is on slow network connection. Is there any way that I can load it in background and show the activity, when the loading is complete? 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
Re: [android-developers] How to load web page in background
I think u could use HttpClient from http://hc.apache.org/httpclient-3.x/ if you try something like this, it might be useful: * HttpGet httpget = new HttpGet(http://www.your_url.com); HttpResponse response = httpClient.execute(httpget); HttpEntity entity = response.getEntity(); entity.consumeContent(); if (entity != null) { entity.consumeContent(); }* I hope it helps you! On Tue, Mar 27, 2012 at 10:54 AM, rk ramakrishnar...@gmail.com wrote: How to load web page in background ? As part of my application, Im supposed to present a web-page to the user. The webpage is about .5M (has lot of images and js), so i cant fire an activity, as user has to see the page loading for considerable amount of time, if user is on slow network connection. Is there any way that I can load it in background and show the activity, when the loading is complete? 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 -- 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
Re: [android-developers] How to load web page in background
Thanks Lucas, Have a small question on the following, entity.consumeContent(); if (entity != null) { entity.consumeContent(); } after consuming, why should we again check for null and consume again ? Can we use SerializableEntity instead of HttpEntity? Please share, If you have any link to sample android program. Thanks Rk On 27 March 2012 19:33, Lucas Diego diegoluc...@gmail.com wrote: I think u could use HttpClient from http://hc.apache.org/httpclient-3.x/ if you try something like this, it might be useful: * HttpGet httpget = new HttpGet(http://www.your_url.com ); HttpResponse response = httpClient.execute(httpget); HttpEntity entity = response.getEntity(); entity.consumeContent(); if (entity != null) { entity.consumeContent(); }* I hope it helps you! On Tue, Mar 27, 2012 at 10:54 AM, rk ramakrishnar...@gmail.com wrote: How to load web page in background ? As part of my application, Im supposed to present a web-page to the user. The webpage is about .5M (has lot of images and js), so i cant fire an activity, as user has to see the page loading for considerable amount of time, if user is on slow network connection. Is there any way that I can load it in background and show the activity, when the loading is complete? 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 -- 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 -- 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
Re: [android-developers] How to load web page in background
Actually we don't need the first consumeContent(); it was a part of test code and I forgot to take it off. :-D well... I had never used SerializableEntity, so I can't say whether it works or not. I think u can create a class or method that returns the html page's code and then showing it in a webview from your android app. something like this: //show progress dialog for user (wainting) if (entity != null) { //get the html code String content = EntityUtils.toString(entity); //put the html code in a webview and show the view } //hide the progress dialog Any time. Lucas On Tue, Mar 27, 2012 at 11:54 AM, Rama Krishna ramakrishnar...@gmail.comwrote: Thanks Lucas, Have a small question on the following, entity.consumeContent(); if (entity != null) { entity.consumeContent(); } after consuming, why should we again check for null and consume again ? Can we use SerializableEntity instead of HttpEntity? Please share, If you have any link to sample android program. Thanks Rk On 27 March 2012 19:33, Lucas Diego diegoluc...@gmail.com wrote: I think u could use HttpClient from http://hc.apache.org/httpclient-3.x/ if you try something like this, it might be useful: * HttpGet httpget = new HttpGet( http://www.your_url.com); HttpResponse response = httpClient.execute(httpget); HttpEntity entity = response.getEntity(); entity.consumeContent(); if (entity != null) { entity.consumeContent(); }* I hope it helps you! On Tue, Mar 27, 2012 at 10:54 AM, rk ramakrishnar...@gmail.com wrote: How to load web page in background ? As part of my application, Im supposed to present a web-page to the user. The webpage is about .5M (has lot of images and js), so i cant fire an activity, as user has to see the page loading for considerable amount of time, if user is on slow network connection. Is there any way that I can load it in background and show the activity, when the loading is complete? 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 -- 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 -- 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 -- 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