Am very new to Android projects. Just i tried to work with TabHost
controller in Android. I have got a code from this link, coderzheaven.com. But, in this code i received one error Syntax error, insert ";" to complete
. Here is my code,
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..
}
}
How can i do this? Please help me. Thanks in advance.
Most likely it is not in fact the ;
causing the problem, but a missing closing }