My code
View view = getLocalActivityManager().startActivity("main_jobs",
new Intent(context,Job_Description.class)
.putExtra("line", str_line).putExtra("limit",str_limit)
.putExtra("limit",""+0)
.putExtra("Alert", false)
.putExtra("str_location", str_loc)
.putExtra("str_Descrption",str_descjob)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
setContentView(view);
I am using this code to open new activity with tab but tab bar not showing and not any error get please help me how we can show tab bar to open new activity
Thanks in Advance
Sample Example : Consider three tabs here First in MainActivity.java
public class MainActivity extends TabActivity {
private static final String TAB1 = "TAB1";
private static final String TAB2 = "TAB2";
private static final String TAB3 = "TAB3";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost();
TabSpec tab1 = tabHost.newTabSpec(TAB1);
tab1.setIndicator(TAB1);
Intent Intent1 = new Intent(this, Tab1.class);
tab1.setContent(Intent1);
TabSpec tab2 = tabHost.newTabSpec(TAB2);
tab2.setIndicator(TAB2);
Intent Intent2 = new Intent(this, Tab2.class);
tab2.setContent(Intent2);
TabSpec tab3 = tabHost.newTabSpec(TAB3);
tab3.setIndicator(TAB3);
Intent Intent3 = new Intent(this, Tab3.class);
tab1.setContent(Intent3);
tabHost.addTab(tab1);
tabHost.addTab(tab2);
tabHost.addTab(tab3);
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="64dp" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>
Then three classes Tab1.java , Tab2.java and Tab3.java And three xml files to that classes.
try it out and say.