Tabbed UI Problem

  • Antworten:2
Jan Kressin
  • Forum-Beiträge: 9

18.06.2011, 11:46:38 via Website

Mahlzeit!

Ich habe folgendes Problem:
Ich versuche ein Tabbes UI zu realisieren und habe mir dazu ein Tutorial angeschaut.
Leider bekomme ich beim debuggen immer eine Fehlermeldung auf dem Emulator:

"Sorry! The Application BusStop (process fh.mci.BusStop) has stopped unexpectedly. Please try again"

Hier der Code für den TabHost

1package fh.mci.BusStop;
2
3import android.app.Activity;
4import android.app.TabActivity;
5import android.content.Intent;
6import android.os.Bundle;
7import android.widget.TabHost;
8
9public class BusStopActivity extends TabActivity {
10 /** Called when the activity is first created. */
11 @Override
12 public void onCreate(Bundle savedInstanceState) {
13 super.onCreate(savedInstanceState);
14 setContentView(R.layout.main);
15
16 TabHost tabhost = getTabHost();
17 TabHost.TabSpec spec;
18 Intent intent;
19
20 intent = new Intent().setClass(this, PlanActivity.class);
21 spec = tabhost.newTabSpec("Plan").setIndicator("Plan").setContent(intent);
22 tabhost.addTab(spec);
23
24 intent = new Intent().setClass(this, NewRouteActivity.class);
25 spec = tabhost.newTabSpec("newRoute").setIndicator("newRoute").setContent(intent);
26 tabhost.addTab(spec);
27
28 intent = new Intent().setClass(this, OldRouteActivity.class);
29 spec = tabhost.newTabSpec("oldRoute").setIndicator("oldRoute").setContent(intent);
30 tabhost.addTab(spec);
31
32 intent = new Intent().setClass(this, OptionsActivity.class);
33 spec = tabhost.newTabSpec("Options").setIndicator("Options").setContent(intent);
34 tabhost.addTab(spec);
35 }
36}

Code von einer der vier Activitys:

1package fh.mci.BusStop;
2
3import android.app.Activity;
4import android.app.TabActivity;
5import android.os.Bundle;
6import android.widget.TabHost;
7import android.widget.TextView;
8
9public class PlanActivity extends Activity {
10 /** Called when the activity is first created. */
11 @Override
12 public void onCreate(Bundle savedInstanceState) {
13 super.onCreate(savedInstanceState);
14 TextView textview = new TextView(this);
15 textview.setText("This is the Plan tab");
16 setContentView(textview);
17 }
18}

Wäre froh wenn mir jemand helfen könnte, vielen Dank im Vorraus!

Antworten
Jan Kressin
  • Forum-Beiträge: 9

18.06.2011, 12:22:14 via Website

Selbst behoben: Einträge in der Manifest.xml fehlten.
Danke :)

Antworten
Markus Gu
  • Forum-Beiträge: 2.644

18.06.2011, 12:22:34 via App

logcat ???

swordiApps Blog - Website

Antworten