When an Activity X is loaded into FrameLayout when tab is changed I want that X to be able access to tmp LinearLayout that is located outside of TabHost.
Assume that TmpActivity is loaded into FrameLayout when some tab was clicked, so in that activity I want do something like this
public void onCreate(Bundle savedInstanceState) {
LinearLayout ll = (LinearLayout)findViewById(R.id.tmp);
}
How I can do this?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/tmp"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="50px"
android:background="#00FF00">
</LinearLayout>
<TabHost
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:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="500px"
android:padding="5dp"
android:background="#FF0000"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FF00FF" />
</LinearLayout>
</TabHost>
</LinearLayout>
You can get your parent activity from your activity loaded in your tab host frame layout. From there, you can access your linear layout throught a getter or a member variable located in your TabHostActivity.