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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:43:45+00:00 2026-06-15T04:43:45+00:00

I am attempting to do some operations with a WebView within an activity and

  • 0

I am attempting to do some operations with a WebView within an activity and was wondering about how to detect when a web page had loaded (this was in relation to an ad serving system). I emailed the very slow ad-agency tech support team, who eventually replied “You can use HTML banners inside a WebView and you will need to implement a WebViewClient class on the WebView”. I wasn’t 100% sure what this meant, but my first guess was to add the words “implements WebViewClient” to my actibvity, i.e.:

public class MyActivity extends Activity implements WebViewClient
{

I was then fully expecting eclipse to tell me that I had some missing imports which it would then give me the option of adding… but to my surprise, the two options were “create interface WebViweClient” and “Fix project setup”. So now I’m confused, not sure what to do next.

Can anyone show me some example code or give me a hint to set me off in the right direction?

EDIT: What I’m attempting to do is load up an ad on a webview, and then at some later time (and having checked that the ad-load was completed), I’ll display the webview.

  • 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-15T04:43:47+00:00Added an answer on June 15, 2026 at 4:43 am
    import android.app.Activity;
    import android.graphics.Bitmap;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;
    
    /*
     * Demo of creating an application to open any URL inside the application and clicking on any link from that URl
    should not open Native browser but  that URL should open in the same screen.
     */
    public class WebViewClientDemoActivity extends Activity {
        /** Called when the activity is first created. */
    
        WebView web;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            web = (WebView) findViewById(R.id.webview01);
            web.setWebViewClient(new myWebClient());
            web.getSettings().setJavaScriptEnabled(true);
            web.loadUrl("http://www.google.com");
        }
    
        public class myWebClient extends WebViewClient
        {
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                // TODO Auto-generated method stub
                super.onPageStarted(view, url, favicon);
            }
    
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
    
                view.loadUrl(url);
                return true;
    
            }
        }
    
        // To handle "Back" key press event for WebView to go back to previous screen.
       @Override
       public boolean onKeyDown(int keyCode, KeyEvent event)
      {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && web.canGoBack()) {
            web.goBack();
            return true;
        }
        return super.onKeyDown(keyCode, event);
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to mock some file operations. In the real object I have: StreamWriter
I am attempting to pivot some data out of the Vendor column in this
I was attempting to make some expression templates as an answer to this question
I am attempting add some tests to an existing QT GUI application using QTest.
I am attempting to modify some existing C++ code to work with my needs,
I am attempting to do some statistics-related functions so I can carry out a
I am attempting to convert some text files into a pdf. Now the easiest
I am attempting to compile some code, but am running into some problems that
I am attempting to load some images into a very basic C++/SDL based program.
I'm attempting to pull some data from a SQLite database so that I can

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.