Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebView not Loading Data?

I'm trying to load the parsed html data from an rss feed using a WebView, but the webview claims that the page:

"data:text/html;utf-8,[The html I'm trying to display]"

is not available.

alt text

I find it strange that it seems to be putting the html data into the url, when I just want it to display it.

Here's my code right now for the webview:

Bundle data = getIntent().getExtras();

WebView webview = new WebView(this);
setContentView(webview);

webview.loadData(data.getString("DEFAULTTEXT"), "text/html", "utf-8");

Where the HTML has been passed in a string in the Bundle with the identifier: DEFAULTTEXT. I've tested the class and the HTML is passed fine, it just isn't displayed correctly.

It works fine on some of the webpages I've tried, but not others. I'll try to post the code of one that works and one that doesn't.

like image 794
Kleptine Avatar asked Jan 01 '10 16:01

Kleptine


1 Answers

Huuu.... so I turned my computer on this morning and it worked perfectly. I still don't know what the problem was. :/

Edit: Never mind. It works on some, but not all of the pages I try to display.

Edit2: swapping it out for loadDataWithBaseURL worked like a charm.

like image 107
Kleptine Avatar answered Oct 23 '22 03:10

Kleptine