I have come up with a private browser,but I want to know how to link it to my code below when the browser is being opened.
Main Class
b5.setOnClickListener(new OnClickListener(){
public void onClick(View v){
Intent i =new Intent(FiltersActivity.this,MyBrowser.class);
i.setData(Uri.parse("http://www.google.com"));
startActivity(i);
}
});
第二类
public class MyBrowser extends Activity {
public void onCreate(Bundle SavedIntstanceState) {
super.onCreate(SavedIntstanceState);
setContentView(R.layout.browser);
Uri uri = getIntent().getData(); // get Intent and the linked data
WebView webview = (WebView) findViewById(R.id.webView_01); // get the
// webview
// item
webview.setWebViewClient(new Callback()); // set the object to the view
// to webview
webview.loadUrl(uri.toString()); // load the url
}
private class Callback extends WebViewClient { // crate a virtual class
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { // /load
// the
// necessary
return (false);
}
}
}