Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android WebView - 1st LoadData() works fine, subsequent calls do not update display

After the 1st call to LoadData() the event onLoadResource fires as it should and the display is fine. Next I want to refresh the screen with a new page, when I use LoadData() the second time the page does not update and onLoadResource() DOES NOT FIRE.

Then second call to LoadData() onlyfires onPageFinished ... onPageStarted never fires!

A work around was to call .reload() after LoadData() but that causes all sorts of problems during the other logic in the activity.

Why doesn't LoadData() work multiple times?

I am using extremely simple HTML, and since using .reload() makes it work my LoadData() statement doesn't seem to be the problem.

Any Ideas would be helpful, TIA

like image 501
Jim Avatar asked Nov 04 '10 12:11

Jim


1 Answers

Use

webview.loadDataWithBaseURL("same://ur/l/tat/does/not/work", "data", "text/html", "utf-8", null);

it works fine. loaddata does not refresh next time the data is loaded.

like image 163
xtera Avatar answered Oct 20 '22 10:10

xtera