Actually, I think I am confusing the issue. I just tried the following
code inside my WebView:-

final String mimeType = "text/html";
final String encoding = "utf-8";
html = "<BR><B>Tonight's weather in London</B><BR>A few evening
showers Min 6C(43F )<BR>Probability of rain: 89%<BR>Minimum
Temperature: 6C(43F )<BR>Wind force Beaufort: 4<BR>Wind description:
Moderate Breeze<BR>Wind direction: SSW<BR>Sunset at: 4:17 pm";
this.loadData(html, mimeType, encoding);


This does not do wha I expect. This displays a WebView with the
following error message:-

Web page not available
The Web page at data:text/html;utf-8...
might be temporarily down..

I was expecting the WebView to use my string as the HTML content. This
is how it works for simpler strings.


On Jan 12, 9:59 pm, Ryan <ryankelly...@hotmail.com> wrote:
> Thanks for your reply Fred. The debug log shows the follwing line for
> getting the text out with the xpp.next() function.
>
> 01-12 21:53:48.705: INFO/System.out(549): Text <BR><B>Tonight's
> weather in London</B><BR>A few evening showers Min 6C(43F )
> <BR>Probability of rain: 89%<BR>Minimum Temperature: 6C(43F )<BR>Wind
> force Beaufort: 4<BR>Wind description: Moderate Breeze<BR>Wind
> direction: SSW<BR>Sunset at: 4:17 pm
>
> The log then shows:-
>
> 01-12 21:53:49.544: INFO/ActivityManager(51): Displayed activity
> com.mycom.myapp/.MyWebViewActivity: 5050 ms
>
> It is this activity that has a WebView that calls the loadData
> function with the string above.
>
> There are no errors as such. It's as if the WebView takes the string
> as a URL and try's to request data from the URL, instead of just
> displaying the string. Does that make sense?
>
> On Jan 12, 9:34 pm, "Fred Grott(shareme)" <fred.gr...@gmail.com>
> wrote:
>
>
>
> > Ryan launch app run using debugger in Eclipse and post the debug
> > log..
>
> > Several of us are developing apps using Webview, I am and several
> > others so the better feedback we can give each other via this list and
> > others helps lift all  our webview skills at once :)
>
> > On Jan 12, 3:19 pm, Ryan <ryankelly...@hotmail.com> wrote:
>
> > > Hi,
>
> > > When I use the WebView.loadData function from a sring returned from
> > > XMLPullParser.nextText, the WebView always displays the following
> > > error message:-
>
> > > Web page not available
> > > The Web page at data:text/html;utf-8...
> > > might be temporarily down..
>
> > > However, if I hard code the same text into the loadData function all
> > > appears fine.
>
> > > My code for parsing the XML is very similar to the api example, which
> > > I have copied below:-
>
> > > public String getHTMLDescription(InputStream xmlData) throws
> > > XmlPullParserException, IOException {
> > > String html = new String();
> > > InputStreamReader reader = new InputStreamReader(xmlData, "UTF-8");
> > > BufferedReader buffer = new BufferedReader(reader);
>
> > > XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
> > > factory.setNamespaceAware(true);
> > > XmlPullParser xpp = factory.newPullParser();
>
> > > xpp.setInput(buffer);
> > > int eventType = xpp.getEventType();
> > > while (eventType != XmlPullParser.END_DOCUMENT) {
> > >            if(eventType == XmlPullParser.START_TAG) {
> > >              if(xpp.getName().compareTo("description") == 0) {
> > >                  html = xpp.nextText();
> > >              }
> > >          eventType = xpp.next();
>
> > > }
>
> > > return html;
>
> > > }
>
> > > Any ideas?
>
> > > Thanks,
>
> > > Ryan- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to