I need sample code to create TabHost in android. can anyone help me.
activity_main.xml contains
and java code is
TabHost tabHost = getTabHost();
TabSpec spec;
Intent intent;
//Home Tab
View view1 = LayoutInflater.from(MainActivity.this).inflate(R.layout.home, null);
intent = new Intent(MainActivity.this, Firstclass.class);
spec = tabHost.newTabSpec("HOME").setIndicator(view1)
.setContent(intent);
tabHost.addTab(spec);
//Calendar Tab
View view2 = LayoutInflater.from(MainActivity.this).inflate(R.layout.calendar_tab, null);
intent = new Intent(MainActivity.this, Calendar.class);
spec = tabHost.newTabSpec("CALENDAR").setIndicator(view2)
.setContent(intent);
tabHost.addTab(spec);