1. You want that $100.00 in your pocket or an Amazon Fire TV don't you? Well here's the deal. With our new updated look we are in desperate need of an updated logo. The 'old' one has certainly served us well, but it's time. Find all the details here: bit.ly/1q0k6Wa
  2. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

preventing webview from opening browser

Discussion in 'Android App Developers' started by jazzmatazz2005, Sep 19, 2013.

  1. jazzmatazz2005
    Offline

    jazzmatazz2005 New Member

    Joined:
    Sep 19, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    i just had an app made for me and i noticed that the webview launches the default browser.
    I've tried different thing but nothing works
    this is my web_activity java
    any help will be much appreciated.


    Code:
    package com.ctechs.audiomix;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.webkit.WebSettings;
    import android.webkit.WebView;
    import com.rocdamic.com.R;
    
    public class Web_activity extends Activity {
    	
    	@Override
    	protected void onCreate(Bundle savedInstanceState) {
    		// TODO Auto-generated method stub
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.web_activity);
    		
    		Intent intent = getIntent();
    		String url_to_open = intent.getExtras().getString("url_to_open");
    		
    		WebView wb_homepage = (WebView)findViewById(R.id.webView1);
    		wb_homepage.getSettings().setJavaScriptEnabled(true);
    		wb_homepage.loadUrl(url_to_open);
    		
    		
    	}
    
    }
  2. aber
    Offline

    aber New Member

    Joined:
    Oct 24, 2013
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    When is the browser launched? When you click on links? In that case you can avoid it by assigning a WebViewClient to the WebView. Try to add this line:

    wb_homepage.setWebViewClient(new WebViewClient());
Search tags for this page

android open link in browser from webview

,

android webview opens browser

,

android webview opens link in browser

,

windows phone webview prevent open in blank