public class MainActivity extends Activity {
private WebView webView1;
Button google;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
google = (Button) findViewById(R.id.google);
google.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
webView1 = (WebView) findViewById(R.id.webView);
webView1.getSettings().setJavaScriptEnabled(true);
webView1.loadUrl("http://www.google.co.in/");
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}