Can we pass whole data in webview

2019-07-19 18:54发布

问题:

I am new in android development.i have to parse data from xml.my xml url is- http://mobileecommerce.site247365.com/admin/catdata.xml

i am able to success parse cat_desc data.Can i show whole data in webview or webview can display only url?

回答1:

Use this, it is the correct answer, as sometimes it is possible it wont show the web view due to some special chas like % and # etc... so use this :-

webview.loadDataWithBaseURL("<some URL>", stringData,"text/html", "utf-8", null);


回答2:

You can display data in a WebView using

webview.loadData(yourString, "text/html", "utf-8");


回答3:

There are two methods for display string data in WebView,

either

webview.loadData( stringData, "text/html", "utf-8");

or

webview.loadDataWithBaseURL("<some URL>", stringData,"text/html", "utf-8", null);