Can we pass whole data in webview

余生颓废 提交于 2019-12-10 22:27:35

问题


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);


来源:https://stackoverflow.com/questions/7832106/can-we-pass-whole-data-in-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!