I have an application with a few tabs which all belong to the same TabHost. Is there any way to change the TextView android:text value before the TabWidget in any activity other than the main activity which extends TabActivity?
This is my 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"
android:background="@color/sigma_darkgray">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/title_color"
android:text="Home page"
android:textStyle="bold"
android:paddingTop="6dip"
android:paddingBottom="6dip"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearance"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="1dip"
android:background="@color/title_color"/>
<View android:id="@+id/separator"
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"
android:layout_centerVertical ="true"
android:layout_alignParentTop="true"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>
Yes You can.
Just give the id to the TextView. And Declare reference of that textview in MainActivity where there ie TabActivity is Extended.
Now in another child activity You can call that textView with the MainActivity.textview object.
Now here you cna change the TextValue of the textView and it is done from child activity.
Enjoy.