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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:06:44+00:00 2026-05-29T08:06:44+00:00

I am facing problem when url is redirected. I set webviewclient and It is

  • 0

I am facing problem when url is redirected. I set webviewclient and
It is supposed to finish webview activity when url is redirected.
But it is not working and I wonder why… below is my code and I would be
appreciated if anyone can help me. thx.

public class WebViewActivity extends Activity {

WebView mWebView;
String fbRegsitered = "http://m.facebook.com/gettingstarted/";
//"http://m.facebook.com/r.php?refid=0
String fbUnregisterd = "http://m.facebook.com/r.php?refid=0";
private ProgressDialog mSpinner;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);
    mWebView = (WebView) findViewById(R.id.webview); 
    mWebView.getSettings().setJavaScriptEnabled(true);  
    mWebView.loadUrl("http://m.facebook.com/r.php");  
    mWebView.setWebViewClient(new HelloWebViewClient()); 
}

@Override 
public boolean onKeyDown(int keyCode, KeyEvent event) { 
    if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) { 
        mWebView.goBack(); 
        return true; 
    } 
    return super.onKeyDown(keyCode, event); 

}

private class HelloWebViewClient extends WebViewClient { 

    @Override 
    public boolean shouldOverrideUrlLoading(WebView view, String url) { 
        //view.loadUrl(url); 
        if(url.contains(fbRegsitered)){
            WebViewActivity.this.finish();
        }
        if(url.startsWith(fbUnregisterd)){              
            //finish();
        }
        return true; 
    } 
}
}
  • 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-29T08:06:45+00:00Added an answer on May 29, 2026 at 8:06 am

    Well, I think its because your this condition,

    if(url.contains(fbRegsitered)){
                WebViewActivity.this.finish();
            }
    

    is not satisfying so its not calling WebViewActivity.this.finish();. The reason is you are loading url - "http://m.facebook.com/r.php" and in the condition you are checking for "http://m.facebook.com/gettingstarted/". So, its returning false where there is not else part to handle the else part.

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

Sidebar

Related Questions

I'm facing this problem again and again, but can't find any solution (except mine,
I'm here facing a problem with a Java web project. The project I'm working
I'm facing a problem that's really strange. It's in every browser. Everything is working
I am facing with problem related Http Connection. MY code : URL url =
I am just facing a problem,can not able to overcome(make be lack of proper
I am facing problem to stop the activity indicator view once it starts. I
This is a very basic and silly question but i am facing this problem
I've been using Zend framework some time now, but I'm facing a problem I
I am facing problem with an Oracle Query in a .net 2.0 based windows
I am facing problem with the control flajaxian.FileUploader i.e. after downloading the dll file

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.