主要活动:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources ressources = getResources();
TabHost tabHost = getTabHost();
Intent intentHome = new Intent().setClass(this, Home.class);
TabSpec tabHome = tabHost
.newTabSpec("Android")
.setIndicator("", ressources.getDrawable(R.drawable.home_icon))
.setContent(intentHome);
tabHost.addTab(tabHome);
}
Home.activity:
public class Home extends Activity {
private WebView browser;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
this.browser = (WebView) findViewById(R.id.browser);
this.browser.setWebViewClient(new WebViewClient());
this.browser.loadUrl("http://google.com");
}
}
当我更改tab我的Home.activity和WebView重新加载时,我该如何关闭它?感谢您的帮助:)