Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4028376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:12:45+00:00 2026-05-20T11:12:45+00:00

With reference to this WebView tutorial, in particular this method private void setupWebView(){ String

  • 0

With reference to this WebView tutorial, in particular this method

private void setupWebView(){
    String MAP_URL = "http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html";
    String centerURL = "javascript:centerAt(" + mostRecentLocation.getLatitude() + ","+ mostRecentLocation.getLongitude()+ ")";
    webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    //Wait for the page to load then send the location information
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public void onPageFinished(WebView view, String url){
            webView.loadUrl(centerURL);
        }
    });
    webView.loadUrl(MAP_URL);
}

I’ve noticed that if I place the webView.loadUrl(centerURL); directly after
webView.loadUrl(MAP_URL); like this

private void setupWebView(){
    String MAP_URL = "http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html";
    String centerURL = "javascript:centerAt(" + mostRecentLocation.getLatitude() + "," + mostRecentLocation.getLongitude()+ ")";
    webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    //Wait for the page to load then send the location information
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public void onPageFinished(WebView view, String url){
            //DO NOTHING
        }
    });
    webView.loadUrl(MAP_URL);
    webView.loadUrl(centerURL);
}

it no longer works. So the centreAt(..) javascript method is contained int the MAP_URL.

I’m wondering if the webView.loadUrl(..) method returns before the url has actually been loaded.
It looks that way since the top method waits for it to load fully before running the javascript

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:12:46+00:00Added an answer on May 20, 2026 at 11:12 am

    Yes, webView.loadUrl() is asynchronous: it returns immediately and WebView keeps working in it’s own thread.

    To monitor WebView page loading use WebViewClient.onPageFinished(..):

    webview.setWebViewClient(new WebViewClient() {
        public void onPageFinished(WebView view, String url) {
            // do something here
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

an svn:externals reference like this dojo -r 21434 http://svn.dojotoolkit.org/src/dojo/trunk/ is happily accepted by subversive
Using a Webview, I would like to find the links inside this page. -(void)webView:(WebView
Reference this page: http://www.ivault.sg/nproduct.php?pid=116&cat=2 Selecting an option on the dropdown box by the side
The Android Developers reference says that both the WebView.PictureListener interface and its onNewPicture() method
Reference: This is a self-answered question. It was meant to share the knowledge, Q&A
For reference this is in a C# MVC2 website. I'm looking to save a
Is it OK to reference this when initializing a field? public class MainClass {
In reference with this question We have a header with a date picked component
In reference to this answer to a Stack Overflow question : what is bench-testing
With the reference to this question:- JavaScript -Change CSS color for 5 seconds Working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.