difference between loadData() and loadDataWithBaseURL() in WebView class.....?
Asked Answered
L

1

7

can anybody tell me the difference between loadData() and loadDataWithBaseURL() in WebView class.

when i used web.loadDataWithBaseURL("",html, mimetype, encoding,""); in my program , where html is the string that contains hard coded html tags, its displaying just like as html page where as when i used loadData(html,mimetype,encoding) in my code the application is closing.

i read the API but could not understand it..... so please help me...

Thanks in Advance

Ash

Lecky answered 7/1, 2011 at 17:12 Comment(0)
E
8

In case someone comes across this, WebView.loadData seems to be broken:

http://code.google.com/p/android/issues/detail?id=1733#c23

http://code.google.com/p/android/issues/detail?id=3552

Variants of the solution suggested in the OP's question seems to be the workaround. I figure nulls are cheaper than "", so I used this:

web.loadDataWithBaseURL(null,html, "text/html", "utf-8",null);
Evelunn answered 17/11, 2011 at 6:5 Comment(1)
thanks this solved my problem! loadData works on Android 3.0 platforms, but breaks on 2.2+ platformsElectrolysis

© 2022 - 2024 — McMap. All rights reserved.