Get HTTP Status Code in Android WebView

It’s not possible (as of the time i’m writing this). The docs for onReceiveError() are ambiguous at best, but it you look at this issue, http://code.google.com/p/android/issues/detail?id=968 It’s clear that HTTP status codes won’t be reported through that mechanism. How it’s possible that the developers wrote WebView with no way to retrieve the HTTP status code … Read more

Android – Open target _blank links in WebView with external browser

After visiting the above links, I come up with this code and hope this helps. wv.getSettings().setSupportMultipleWindows(true); wv.setWebChromeClient(new WebChromeClient() { @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg) { WebView.HitTestResult result = view.getHitTestResult(); String data = result.getExtra(); Context context = view.getContext(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(data)); context.startActivity(browserIntent); return false; } });

How to get loaded web page title in Android WebView?

You’ll have to use a custom WebViewClient to get this done. You will override the onPageFinished() method so when a new page finishes loading you can set the webview to the appropriate title. Below is a sample implementation of the above: WebView mWebView = (WebView) findViewById(R.id.mwebview); mWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String … Read more

Webview with asynctask on Android

Don’t use AsyncTask, as you are not in charge of loading the webview. If you want to show a progress dialog, here is how to do it. private ProgressDialog dialog = new ProgressDialog(WebActivity.this); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview); webView = (WebView) findViewById(R.id.webView1); Bundle extras = getIntent().getExtras(); String url=extras.getString(“adres”); webView.setWebViewClient(new WebViewClient() { @Override … Read more

Android : Html Anchor Link works only once in webview

The problem was to Reload the Page again after Anchor link Click. I have used the following code, chapters.xml in Assets folder <html> <body> <p><a href=”#C4″>See also Chapter 4</a></p> <p><h2><a name=”C1″>Chapter 1<a></h2><p>This chapter explains ba bla bla</p> <h2>Chapter 2</h2><p>This chapter explains ba bla bla</p> <h2>Chapter 3</h2><p>This chapter explains ba bla bla</p> <h2><a name=”C4″>Chapter 4</a></h2><p>This chapter … Read more

Android WebView VS Phone Browser

This article outlines your speculation about stock browser differences between manufacturers, that absolutely is true: 5 reality checks every team needs before working on Android webkit …which does cause trouble and mysterious/difficult to diagnose/solve problems. As far as your issues with your WebView implementation: Version of jquery-mobile may be an issue jquery-mobile loaded into an … Read more

How to load html string in a webview?

To load your data in WebView. Call loadData() method of WebView wv.loadData(yourData, “text/html”, “UTF-8″); You can check this example http://developer.android.com/reference/android/webkit/WebView.html [Edit 1] You should add — \ — before — ” — for example –> name=\”spanish press\” below string worked for me String webData = “<!DOCTYPE html><head> <meta http-equiv=\”Content-Type\” ” + “content=\”text/html; charset=utf-8\”> <html><head><meta http-equiv=\”content-type\” … Read more