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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:56:38+00:00 2026-05-27T05:56:38+00:00

If anyone can help me with this I will be very happy. I have

  • 0

If anyone can help me with this I will be very happy. I have an application that uses webview. The webview loads a url and I have used the Google tutorial to overide all the other links that I want to open with webview also. I have create an animimation file in res/ and a slide_right xml and so far so good. I call the effect in my main java activity but it only applies to the first page. The thing that I want is the effect to apply in every page that links loads in webview.

Can you help my with my code?

package com.ihome;

import android.app.Activity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;



public class IhomeActivity extends Activity {
    WebView mWebView;
    private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Animation slideRightAnimation = AnimationUtils.loadAnimation(getBaseContext (), R.anim.slide_right);
            mWebView.startAnimation(slideRightAnimation);
            view.loadUrl(url);
            return true;
        }
    }


@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
            Animation slideLeftAnimation = AnimationUtils.loadAnimation(getBaseContext (), R.anim.slide_left);
            mWebView.startAnimation(slideLeftAnimation);
            mWebView.goBack();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl("http://www.google.com/");
    mWebView.setWebViewClient(new HelloWebViewClient());
  • 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-05-27T05:56:39+00:00Added an answer on May 27, 2026 at 5:56 am

    This is the best I could do with the native apis, it seems the timing isn’t quite right because the loading of the page and animation are asynchronous.. EDIT: updated, this one is marginally better. EDIT2: This is my best attempt so far, and it allows the user to realize that the page is loading.. The only way to get a semi-smooth animation is to allow the page to preload, while the user does not see it.

    package com.adeptdev.animwebview;
    
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.view.View;
    import android.view.animation.Animation;
    import android.view.animation.AnimationUtils;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;
    
    public class HelloWebViewActivity extends Activity {
        ProgressDialog mProgressDialog;
    
    
        private class HelloWebViewClient extends WebViewClient {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.setVisibility(View.GONE);
                mProgressDialog.setTitle("Loading");
                mProgressDialog.show();
                mProgressDialog.setMessage("Loading " + url);
                return false;
            }
    
            @Override
            public void onPageFinished(WebView view, String url) {
                mProgressDialog.dismiss();
                animate(view);
                view.setVisibility(View.VISIBLE);
                super.onPageFinished(view, url);
            }
        }
    
        private void animate(final WebView view) {
            Animation anim = AnimationUtils.loadAnimation(getBaseContext(),
                    android.R.anim.slide_in_left);
            view.startAnimation(anim);
        }
    
        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) {
            WebView view = (WebView) findViewById(R.id.webview);
            if ((keyCode == KeyEvent.KEYCODE_BACK) && view.canGoBack()) {
                view.goBack();
                return true;
            }
            return super.onKeyDown(keyCode, event);
        }
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            mProgressDialog = new ProgressDialog(this);
            WebView webView = (WebView) findViewById(R.id.webview);
            webView.setVerticalScrollBarEnabled(false);
            webView.setHorizontalScrollBarEnabled(false);
            webView.getSettings().setJavaScriptEnabled(true);
            webView.loadUrl("http://www.google.com/");
            webView.setWebViewClient(new HelloWebViewClient());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if anyone can help - I have this error showing recently when
Can anyone help me to do this in the right way?I mean.. like that
Can anyone help me getting started with this? We have a current keygen for
internet cake for anyone who can help me with this. I have a long
Can anyone help - this is driving me mad. I am calling a mysql
Can anyone help with this... vector<unsigned int> *vVec = new vector<unsigned int>; vVec .reserve(frankReservedSpace);
Can anyone help convert this this actionscript to Objective-c? if(mcMain.y >= stage.stageHeight - mcMain.height)
Can anyone help in this php page navigation script switch on counting normal serial
can anyone help me with this issue? i tried it but the frame of
Can anyone help me with this error? alt text http://abbeylegal.com/downloads/parsererror.jpg full image here It

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.