preventing webview from opening browser

jazzmatazz2005

New Member
Joined
Sep 19, 2013
Messages
1
Reaction score
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);
		
		
	}

}
 

aber

New Member
Joined
Oct 24, 2013
Messages
2
Reaction score
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());
 
Top