对 Android项目来说是一个新手.我试图在Android中使用TabHost控制器.我有一个来自此链接的代码, coderzheaven.com.但是,在此代码中我收到一个错误语法错误,插入“;”去完成.这是我的代码, pa
package tab.fragment;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
public class TabBarSample extends TabActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec firstTabSpec = tabHost.newTabSpec("tab_id1");
TabSpec secondTabSpec = tabHost.newTabSpec("tab_id2");
TabSpec thirdTabSpec = tabHost.newTabSpec("tab_id3");
firstTabSpec.setIndicator("Time").setContent(new Intent(this,Time.class));
secondTabSpec.setIndicator("Date").setContent(new Intent(this,Date.class));
thirdTabSpec.setIndicator("Option").setContent(new Intent(this,Option.class));
tabHost.addTab(firstTabSpec);
tabHost.addTab(secondTabSpec);
tabHost.addTab(thirdTabSpec); //Here the error occuring..
}
}
我怎样才能做到这一点?请帮我.提前致谢.
最有可能的事实并非如此;导致问题,但缺少关闭}