Groups
Conversations
All groups and messages
Send feedback to Google
Help
Sign in
Groups
Android Developers
Conversations
About
How to detect the web page was load finished??
384 views
Skip to first unread message
Rick
unread,
Jan 31, 2008, 9:51:46 AM
1/31/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Link
Report message as abuse
Sign in to report message as abuse
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android Developers
Dear all,
I try to load some web page step by step, and detect the current
page was load finished before load next page.
Here is my code :
//default page is "
http://www.microsoft.com/en/us/
default.aspx"
wv.loadUrl("
http://www.yahoo.com
");
showAlert("Current Page 1 : ",wv.getUrl(), "ok", false);
while(wv.getProgress()<100)
{
}
wv.loadUrl("
http://www.google.com
");
showAlert("Current Page 2 : ",wv.getUrl(), "ok", false);
while(wv.getProgress()<100)
{
}
But, the alert message shows
"Current Page 1 :
http://www.microsoft.com/en/us/default.aspx
"
"Current Page 2 :
http://www.microsoft.com/en/us/default.aspx
"
and wv.getProgress() = 100
It seems asynchronous.
Any way to solve the problem??
muntzen
unread,
Jan 31, 2008, 3:45:07 PM
1/31/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Link
Report message as abuse
Sign in to report message as abuse
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android Developers
Use a BrowserCallback:
http://code.google.com/android/reference/android/webkit/BrowserCallback.html
Using your code as an example:
wv.setBrowserCallback(new WebViewCallback());
...
// create an inner class to handle the callbacks from the webview
/* package-scope */ class WebViewCallback extends
BrowserCallbackAdapter
{
// when the resource loads add a javascript interface
public void setProgress(int progress)
{
if (progress == 100)
.....
muntzen
unread,
Jan 31, 2008, 3:46:01 PM
1/31/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Link
Report message as abuse
Sign in to report message as abuse
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Android Developers
haha, ignore that javascript interface comment. that was some test
code. :)
On Jan 31, 3:45 pm, muntzen <
ericmu...@gmail.com
> wrote:
> Use a BrowserCallback:
http://code.google.com/android/reference/android/webkit/BrowserCallba.
..
Reply all
Reply to author
Forward
0 new messages