I am trying for two days to find a code to work with what I have.. I am following this tutorial: http://techvalleyprojects.blogspot.ro/2011_08_01_archive.html
I have the following problem: The webpage I want to open in my app is not loaded inside my webview, instead it opens in the default browser. How can I modify my code so that all links open in the webview. I need a easy solution because I am very new to Android..
Thank you.
package com.example.name;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
public class MainActivity extends Activity {
WebView browser;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// find the WebView by name in the main.xml of step 2
browser=(WebView)findViewById(R.id.wvwMain);
// Enable javascript
browser.getSettings().setJavaScriptEnabled(true);
// Set WebView client
browser.setWebChromeClient(new WebChromeClient());
// Load the webpage
browser.loadUrl("http://news.google.com/");
}
}