Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 188
Registered: ‎07-19-2012
My Device: Z10 Limited Edition and Dev Alpha C
My Carrier: Movistar-Venezuela

Help ActivityIndicator with Webview

Who could help me with a code webview + ActivityIndicator. When loading the page, I leave the indicator, but is removed when the page loads 100%.

 

IMG_00000034.png

 

I have that but it does not disappear when loading pa facebook page


Follow me in Twitter:

@Marcossit

BBM Channel:

MarcossitDev: C0002C366  

DeviceSuite For BlackBerry 10:

Link to Download DeviceSuite:

Support was successful? Accept as Solution and click on:


Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Help ActivityIndicator with Webview

[ Edited ]

Lets see some of your code!

 

You should be connecting to the webviews loadProgressChanged SLOT similar to this:

connect(m_WebContent, SIGNAL(loadProgressChanged ( int )),
					this, SLOT(updateProgress ( int )));

 In updateProgress you would do something like this:

void YourClass::updateProgress ( int loadProgress )
{
if(loadProgress > 99.9f) {
//loading is done, don't need the SLOT anymore. disconnect(m_WebContent, SIGNAL(loadProgressChanged ( int )), this, SLOT(updateProgress ( int )));

//Loading is done, set the activity indicator to invisible. m_WebProgressIndicator->setVisible(false); }
//Update the indicator. m_WebProgressIndicator->setValue((int)loadProgress);
}

 I'm using a progress indicator, so you would not need to update the value at any point except when loading is finished, if you are using an ActivityIndicator instead.

 

If you're using QML here's a code sample.

You would do:

 

onLoadingChanged: {
    if (loadRequest.status == WebLoadStatus.Succeeded) {
        qDebug() << "Load finished.";
        idOfActivityIndicator.setVisible(false);
    }
}

 

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!