Android Question Loading a weather widget with Webview1

Colin Evans

Active Member
Licensed User
Longtime User
Hi, Before I upgraded to the latest version my weather page worked well using Accuweather widget but now all I get is a blank page with Loading Widget being displayed

I've tried it with the Met Office widget but have the same results, just a blank screen

The code is
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("page4")
    Activity.Title = "DITL - Weather"
    WebView1.LoadHtml($"<a href="http://www.accuweather.com/en/gb/rhyl/ll18-4/weather-forecast/322483" class="aw-widget-legal"></a><div id="awcc1496679191204" class="aw-widget-current"  data-locationkey="322483" data-unit="f" data-language="en-us" data-useip="false" data-uid="awcc1496679191204"></div><script type="text/javascript" src="https://oap.accuweather.com/launch.js"></script>"$)
    Activity.AddMenuItem("Home","mnuPage1")
    Activity.AddMenuItem("Tide Tables","mnuPage2")
    Activity.AddMenuItem("GPS","mnuPage3")
    Activity.AddMenuItem("Knots","mnuPage4")
    Activity.AddMenuItem("Weather","mnuPage5")
    Activity.AddMenuItem("Rhyl Charts","mnuPage6")
    Activity.AddMenuItem("Exit","mnuPage7")      
End Sub

Can anyone help
Many thanks
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried to load the html with on the PC:

SS-2017-06-07_08.55.30.png


It fails to loads a resource because it assumes that the scheme will be http or https. In this case the scheme is file://. You will need to host the html code online and load it with WebView.LoadURL.
 
Upvote 0

Colin Evans

Active Member
Licensed User
Longtime User
Hi Erel, many thanks for taking the time to reply and explain what the problem appears to be, unfortunately I'm still not sure what I should do to get it working or why it was originally and now isn't. Is it something that the accuweather site have changed and I should ask them, or is there a work around, thanks again.
 
Upvote 0
Top