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 8209265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:39:50+00:00 2026-06-07T09:39:50+00:00

I’m working with Android and Phonegap, and at the moment I’m having trouble with

  • 0

I’m working with Android and Phonegap, and at the moment I’m having trouble with one simple thing. I need to setup a webViewClient to the PhoneGap webView in order to capture the URL of a page finished and to work with that.

This is the code:

public class PhoneGapTest extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.setBooleanProperty("loadInWebView", true);
        super.clearCache();
        super.keepRunning = false; 
        super.loadUrl("file:///android_asset/www/index.html");

        super.appView.setWebViewClient(new WebViewClient(){

          @Override
          public void onPageStarted(WebView view, String url, Bitmap bitmap) {

            Log.i("TEST", "onPageStarted: " + url);

          }

          @Override
          public void onPageFinished(WebView view, String url) {

            Log.i("TEST", "onPageFinished: " + url);

          }

        });

    }

That code doesn’t seems to work, the page never loads and I get a TIMEOUT ERROR, but if I remove the “setWebViewClient” part the page loads perfectly.

I saw that there is a class CordovaWebViewClient, do I have to use that instead of WebViewClient? I found this way on the web:

        this.appView.setWebViewClient(new CordovaWebViewClient(this){

          @Override
          public boolean shouldOverrideUrlLoading(final WebView view, String url) { 
            Log.i("BugTest", "shouldOverrideUrlLoading: " + url); 
            return true; 
          }

          @Override
          public void onPageStarted(WebView view, String url, Bitmap bitmap) {

            Log.i("TEST", "onPageStarted: " + url);

          }

          @Override
          public void onPageFinished(WebView view, String url) {

            Log.i("TEST", "onPageFinished: " + url);

          }

          @Override
          public void doUpdateVisitedHistory(WebView view, String url, boolean isReload){        
          }

        });

But that code isn’t working either, I still got a TIMEOUT ERROR.
I also saw that there is already a webVieClient member, but I don’t if I have to use it and how.

I’m working with Phonegap version 1.9.0

Thanks for reading


Answer to Simon:

It worked this way, thanks!

public class MainActivity extends DroidGap {

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    super.init();
    super.appView.clearCache(true);
    super.appView.clearHistory();
    this.appView.setWebViewClient(new CustomCordovaWebViewClient(this));
    super.loadUrl("file:///android_asset/www/index.html");
}

public class CustomCordovaWebViewClient extends CordovaWebViewClient {

 public CustomCordovaWebViewClient(DroidGap ctx) {
   super(ctx);
 }

 @Override
 public void onPageStarted(WebView view, String url, Bitmap bitmap) {
   super.onPageStarted(view, url, bitmap);
   Log.i("TEST", "onPageStarted: " + url);
 }

 @Override
 public void onPageFinished(WebView view, String url) {
   super.onPageFinished(view, url);
   Log.i("TEST", "onPageFinished: " + url);
 }

 @Override
 public void doUpdateVisitedHistory(WebView view, String url, boolean isReload){  
     super.doUpdateVisitedHistory(view, url, isReload);  
 }

 @Override
 public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
     super.onReceivedError(view, errorCode, description, failingUrl);
 }

}

}
  • 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-07T09:39:53+00:00Added an answer on June 7, 2026 at 9:39 am

    To accomplish what you want to do I would extend the CordovaWebViewClient class and override the methods you want but don’t forget to call the super methods or PhoneGap won’t work without the CordovaWebViewClient as it is an important class.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.