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

  • SEARCH
  • Home
  • 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 7885323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:02:08+00:00 2026-06-03T05:02:08+00:00

I got a webview, which has a JSInterface : mWebView.addJavascriptInterface(new JSInterfacelistArticle(mWebView, this, website), interfaceWebsite);

  • 0

I got a webview, which has a JSInterface :

mWebView.addJavascriptInterface(new JSInterfacelistArticle(mWebView, this, website), "interfaceWebsite");

When I use javascript function to call functions from my interface :

window.interfaceWebsite.doToast(info);

It’s working fine the first time, but when my activity finish(), and then I come back to this one, I got this error :

E/Web Console(28654): Uncaught TypeError: Cannot call method 'doToast' of undefined at :1

Why my interface is not working when I start my activity a second time ?

Edit:
If I remove window. when I call a function, I got :

Uncaught ReferenceError: interfaceWebsite is not defined at :1

So I’m sure my interface has a problem when loading for a second time…

Thanks

  • 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-06-03T05:02:10+00:00Added an answer on June 3, 2026 at 5:02 am

    I overwritted my loadurl function for my webview :

    mWebView.setWebViewClient(new WebViewClient() {
                   @Override
                   public boolean shouldOverrideUrlLoading(WebView view, String urlNewString) {
                       loadingFinished = false;
                       mWebView.loadUrl(urlNewString);
                       return true;
                   }
    
                   @Override
                   public void onPageFinished(WebView view, String url) {
                       super.onPageFinished(view, url);
                       loadingFinished = true;
                    }
                });
    

    I needed to set loadingFinished into a static variable sometimes ago, but I forgot that my var will not be updated when I create a new instance of my activity : just need to set loadingFinish at false;

    Now, my thread wait until my webview load the website completely

    Yeah, pretty stupid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using webview in my xcode javascript refuses to run. has anyone got any
I have WebView which loads some page, when it's finished I apply some javascript
I'm got a custom webview setup which is working pretty well, but I'd like
I've got a desktop browser app which uses a WebView to host a Flash
I've got a native Android app that contains a WebView. All my HTML, js
Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
Got a strange problem created a little stored proc which need to execute a
Got a c#.net app which I need to modify. The query at the moment
I'm new in android development and I am trying out the WebView example in
I've got WebView, JS code inside it. Also I have interface to allow Java

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.