I am doing an android project which uses a Tabhost to link to 3 fragments and need some communication between them. Each tab will include another xml file. I linked different element in different sml file to the .java
file. But it doesn't seem to work. Here is the code:
In Main.xml
<TabHost>
<LinearLayout>
<include
android:id="@+id/fragmentreview"
layout="@layout/fragentreview"/>
</LinearLayout>`
In fragentreview.xml
<LinearLayout>
<TextView
android:id="@+id/textViewinfragR"
android:text="Text in new xml reviews" />
</LinearLayout>`
In fragment.class
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragentreview, container, false);
txtMsgR = (TextView)rootView.findViewById(R.id.textViewinfragR);
txtMsgR.setText("Main Car integer = ");
return rootView;
}
When I launch the app textViewinfragR it should show Main Car integer =
but it is still showing Text in new xml reviews
. Is there a problem in my code?