语法错误,插入“;”在Android中完成声明?
对于Android项目来说非常新颖。只是我试图在Android中使用TabHost
控制器。我从这个链接获得了一个代码,coderzheaven.com。但是,在这段代码中,我收到了一个错误Syntax error, insert ";" to complete
。这里是我的代码,语法错误,插入“;”在Android中完成声明?
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..
}
}
我该怎么做?请帮帮我。提前致谢。
最有可能不是实际上;
造成问题的原因,但缺少一个右}
谢谢。在这里,我编辑并发布了参考的完整代码。请帮我找出解决方案。谢谢。 – Gopinath 2011-12-24 09:16:00
我们需要看到更多:比如,你在输入什么?由于提供的块不包含错误,所以文件中必须有更多。它仍然很可能是一个缺失的关闭'''你有没有试过在子句的末尾添加那个,甚至是在文件的末尾? – TryTryAgain 2011-12-24 09:28:40
感谢您的回复。我编辑了我的问题并发布了整个代码。谢谢。 – Gopinath 2011-12-24 10:22:35
您可能会看到这一点,如果你是直接从网页/ PDF的应对粘贴代码。在eclipse IDE中看不到隐藏的字符。在将其放入IDE之前,可以将其粘贴到文本板中。
您发布的代码中没有语法错误。错误很可能是由于这些行上的错误语法造成的。 – Mat 2011-12-24 09:08:55
@Mat谢谢。在这里,我编辑并发布了参考的完整代码。请帮帮我。 – Gopinath 2011-12-24 09:15:28
这是你的完整文件吗?您发布的内容中仍然没有语法错误。 – Mat 2011-12-24 09:19:58