Estou tentando criar um tab layout, do próprio exemplo do android: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
public class AppDroidesp extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, Tab1.class);
spec = tabHost.newTabSpec("tab1").setIndicator("Tab1").setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(1);
}
}
public class Tab1 extends Activity{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView textView = new TextView(this);
textView.setText("Tab1");
setContentView(textView);
}
}
<?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: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>
</TabHost>
Só que no emulador aparece esse erro:
The application Droidesp (process br.droidesp) has stopped unexpectedly. Please try again
Alguem sabe o que pode ser?