What does stopLoading() really do?

Yes, I know the documentation for stopLoading() says “Stops the current load.

But when I try to use it to stop loading currently progressing page before loading a new one, it doesn’t seem to behave as desired:

  • Reading shared preferences
  • Getting Gradle error “Could not reserve enough space for object heap” constantly in Intellij IDEA
  • Android OutOfMemoryError:?
  • How to change color of the bubble(under cursor) on EditView (PROGRAMATICALLY)?
  • ViewPager with FragmentPagerAdapter does not show content
  • GridView elements changes their place dynamically when scroll screen
  • 07-24 12:53:30.177: V/WebView.loadUrl: http://www.google.com
    07-24 12:53:30.227: V/WebViewClient.onPageStarted: http://www.google.com
    ===> WebView.stopLoading() called here <====
    07-24 12:53:31.917: V/WebView.loadUrl: http://www.stackoverflow.com
    07-24 12:53:32.697: V/WebViewClient.onPageFinished: http://www.google.com
    07-24 12:53:32.767: V/WebViewClient.onPageStarted: http://www.stackoverflow.com
    07-24 12:53:33.587: V/WebViewClient.onPageFinished: http://www.stackoverflow.com

    As you can see in the log, WebViewClient.onPageFinished() for the first loadUrl() gets called despite the fact that WebView.stopLoading() was called about 1 second earlier.

    Why is that?

    What does stopLoading() really do?

  • Android tool to generate selector xml for buttons
  • Google Drive SDK for OCR
  • When should the dimens.xml file be used in Android?
  • Error after updating the Android.Support Library v7 AppCompat to the 21.0.3 version
  • New Google sign in Android
  • Gradle Duplicate Entry: java.util.zip.ZipException
  • One Solution collect form web for “What does stopLoading() really do?”

    you786 is right:

    public void stopLoading() {
        // TODO: should we clear all the messages in the queue before sending
        // STOP_LOADING?

    For that TODO they marked in the remaining messages would get processed in first. So that results in what I am just curious about: when stopping load in

    WebViewClient.onReceivedError(WebView view, int errorCode, String description, String failingUrl)

    The WebView does not really stops, instead it loads its own 404 Page (what it normally would do if you don’t call stopLoading()):

    11-07 16:30:01.112: I/MainActivity(19189): Loading:
    11-07 16:30:01.253: V/MainActivity.WebViewClient(19189): SHOULD_INTERCEPT_REQUEST:
    11-07 16:30:01.347: V/MainActivity.WebViewClient(19189): PAGE_STARTED:
    11-07 16:30:01.347: V/MainActivity.WebChromeClient(19189): ON_PROGRESS_CHANGED: 10
    11-07 16:30:01.347: V/MainActivity.WebViewClient(19189): LOAD_RESOURCE:
    11-07 16:30:25.292: I/GATE(19189): <GATE-M>DEV_ACTION_ERROR</GATE-M>
    11-07 16:30:25.300: E/MainActivity.WebViewClient(19189): (CONNECT - Failed to connect to the server) ->
    11-07 16:30:25.300: W/MainActivity.WebViewClient(19189): loading stopped..:
    11-07 16:30:25.300: V/MainActivity.WebViewClient(19189): PAGE_STARTED:
    11-07 16:30:25.300: I/MainActivity.WebViewClient(19189): PAGE_FINISHED:
    11-07 16:30:25.339: I/MainActivity.WebChromeClient(19189): ON_RECEIVED_TITLE: Webseite nicht verf├╝gbar
    11-07 16:30:25.339: V/MainActivity.WebChromeClient(19189): GET_VISITED_HISTORY
    11-07 16:30:25.339: I/GATE(19189): <GATE-M>DEV_ACTION_COMPLETED</GATE-M>
    11-07 16:30:25.339: V/MainActivity.WebChromeClient(19189): ON_PROGRESS_CHANGED: 100
    11-07 16:30:25.339: I/MainActivity.WebViewClient(19189): PAGE_FINISHED:
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.