Android Question Load webpage in background

Discussion in 'Android Questions' started by ttsolution, Jul 25, 2015.

  1. ttsolution

    ttsolution Member Licensed User

    Dear All,

    Using webview, is there any way to load aspx web pages in background? My Activity have 04 webview, I want to load the webview1 first and the the webview2,webview3,webview4 in background.

    Many thanks for any help.

  2. ArminKH

    ArminKH Well-Known Member

    put this code into a Service
    Public Sub AddWebView(WebView1 As WebView)
    End Sub
    then use this code in your activity
  3. Erel

    Erel Administrator Staff Member Licensed User

    The answer above is incorrect.

    WebView always loads its content in the background. If for some reason you want to load the first page and only then start loading the second page then you need to handle the PageFinished event and then load the next page.
    ArminKH likes this.
  4. ArminKH

    ArminKH Well-Known Member

    Erel my post is about a way to use webview in service when our app is closed
    I know activity object can't assigned in service but this code works and this is my own solution for example when i want to reload a web page on background when my app is closed(Anti Idle user)
    Is this wrong?
    Last edited: Jul 26, 2015
  5. Erel

    Erel Administrator Staff Member Licensed User

    Maybe I misunderstood the original question. I don't recommend using a WebView from a service. You should instead use HttpUtils2.
    ArminKH likes this.
  6. ttsolution

    ttsolution Member Licensed User

    My case is : I have an aspx webpage show a sales report by Quarter. In my activity I have 04 webview stand for Quater1,Quater2, Quater3, Quater4 and I'm using
    StdViewPager that allows user slide Quarter to Quarter. For optimized loading speed I wish to load the current Quarter first and the remain 03 quarters will be loaded in background.

    I tried with arminkh solution & I works

    Many thanks,

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice