My Tools.java :
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tabtools);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
// TabDados
intent = new Intent().setClass(this, ToolDadosTubuCirc.class);
spec = tabHost.newTabSpec("dados")
.setIndicator("Dados", res.getDrawable(R.drawable.icondados))
.setContent(intent);
tabHost.addTab(spec);
// TabLegenda
intent = new Intent().setClass(this, ToolLegendaTubuCirc.class);
spec = tabHost
.newTabSpec("legenda")
.setIndicator("Legenda",
res.getDrawable(R.drawable.iconlegenda))
.setContent(intent);
tabHost.addTab(spec);
// TabCalcular
intent = new Intent().setClass(this, ToolCalcularTubuCirc.class);
spec = tabHost
.newTabSpec("calcular")
.setIndicator("Calcular",
res.getDrawable(R.drawable.iconcalcular))
.setContent(intent);
tabHost.addTab(spec);
// TabCorrente
tabHost.setCurrentTab(0);}}
My tabtools.xml
<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"
android:layout_above="@+layout/rowLog"
android:layout_below="@+layout/rowLine" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
The first tab is called the class "ToolDadosTubuCirc.java" and this activity has the following code:
package br.com.mobile4you.engtools;
import android.app.Activity;
import android.os.Bundle;
public class ToolCalcularTubuCirc extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.toolcalculartubucirc);
}
}
**How to create an event within the file onClickListener "ToolDadosTubuCirc.java"? I need to create a function that when people click on the tab "calcular" do some test data it should fill in the tab "dados".
I have 3 tabs: tab1 = data; tab2 = legend; tab3 = calculate. The corrent tab is the "data". I need to check when the User click on the tab "calculate" to all fields of the tab "Data" was completed. I do not know create the onclickListener event for TabDados in other activity(class). I dont know the id of the tabhost and TabWidget. How to create this event? Thank you!**
If the id of my tabhost is standard android and my id is also TabWidget. I am not able to do this event. Help me.