getTabHost() is a method of TabActivity not Activity. You'll need to extend that instead of Activity for the method to be defined
in your object.
MainActivity 继承自Activity ,当使用 getTabHost(),会提示getTabHost() is undefined,这是因为getTabHost()不是Activity的方法函数,需要将继承Activity改成TabActivity ,即可。
例:
public class TabHostActivity extends TabActivity {
private TabHost tabHost;
private Intent certificateIntent;
private Intent feeIntent;
private Intent scoreIntent;
private Intent studyIntent;
private Intent moreIntent;
@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tabHost = getTabHost();
initIntent();
addSpec();
}