Wow so simple, thanks a lot Kostya, struggled with that for so long. On Apr 30, 2:01 pm, Kostya Vasilyev <[email protected]> wrote: > I believe the message means this: > > <TabHost android:id="*@+id/tabhost*" > > should be changed to: > > <TabHost android:id="*@android:id/tabhost*" > > In other words, referencing the id value defined by Android, rather than > assigning a new id value in your application. > > Same with > > <FrameLayout android:id="*@+id/tabcontent*" > > -- Kostya > > 30.04.2011 21:50, plutonianandroid ?????: > > > > > > > I get this error from LogCat and can't understand why, driving me > > crazy: 04-30 13:21:26.388: ERROR/AndroidRuntime(12408): Caused by: > > java.lang.RuntimeException: Your content must have a TabHost whose id > > attribute is 'android.R.id.tabhost' > > > import android.app.TabActivity; > > import android.content.res.Resources; > > import android.os.Bundle; > > import android.widget.TabHost; > > > public class GreenhouseAppTabWidget extends TabActivity { > > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > Resources res = getResources(); > > TabHost tabHost=(TabHost)findViewById(R.id.tabhost); > > tabHost.setup(); > > TabHost.TabSpec spec; // Reusable TabSpec for each tab > > > // Initialize a TabSpec for each tab and add it to the TabHost > > spec = tabHost.newTabSpec("tag").setIndicator("Tag", > > res.getDrawable(R.drawable.ic_menu_wizard)) > > .setContent(R.id.tagView); > > > tabHost.addTab(spec); > > > spec = tabHost.newTabSpec("scan").setIndicator("Scan", > > res.getDrawable(R.drawable.ic_menu_barcode)) > > .setContent(R.id.scanView); > > tabHost.addTab(spec); > > > spec = tabHost.newTabSpec("data").setIndicator("Data", > > res.getDrawable(R.drawable.ic_menu_piechart)) > > .setContent(R.id.dataformView); > > tabHost.addTab(spec); > > > tabHost.setCurrentTab(0); > > } > > } > > main.xml looks like this: > > > <?xml version="1.0" encoding="utf-8"?> > > <TabHost android:id="@+id/tabhost" xmlns:android="http:// > > schemas.android.com/apk/res/android" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent"> > > <TabWidget android:id="@+id/tabs" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content"/> > > <FrameLayout android:id="@+id/tabcontent" > > android:padding="5dp" android:layout_height="fill_parent" > > android:layout_width="fill_parent"> > > > <LinearLayout android:id="@+id/tagView" > > > > xmlns:android="http://schemas.android.com/apk/res/android" > > android:layout_height="fill_parent" > > android:orientation="vertical" > > android:layout_width="fill_parent"> > > <TextView > > android:id="@+id/tagIDTextView" android:text="@string/ > > tagid_lbl" android:layout_height="wrap_content" > > android:layout_width="wrap_content"></TextView> > > <EditText android:text="EditText" > > android:layout_height="wrap_content" android:id="@+id/upcEditText" > > android:layout_width="wrap_content" android:editable="false"></ > > EditText> > > <Button android:onClick="startScan" > > android:layout_height="wrap_content" android:text="@string/ > > tagid_btn_lbl" android:id="@+id/tagIDButton" > > android:layout_width="wrap_content"></Button> > > <TextView android:id="@+id/gpsTextView" > > android:text="@string/ > > gps_txt" android:layout_height="wrap_content" > > android:layout_width="wrap_content"></TextView> > > <EditText android:text="EditText" > > android:layout_height="wrap_content" android:id="@+id/gpsEditText" > > android:layout_width="fill_parent" android:editable="false"></ > > EditText> > > <Button > > android:layout_height="wrap_content" > > android:text="@string/gps_btn_lbl" android:id="@+id/gpsButton" > > android:layout_width="wrap_content"></Button> > > <ImageView > > android:layout_width="wrap_content" android:id="@+id/ > > imageView1" android:layout_height="wrap_content" > > android:src="@drawable/icon"></ImageView> > > <Button android:onClick="collectData" > > android:layout_height="wrap_content" android:text="@string/ > > collect_btn_lbl" android:id="@+id/button1" > > android:layout_width="wrap_content"></Button> > > </LinearLayout> > > > <LinearLayout > > xmlns:android="http://schemas.android.com/apk/res/ > > android" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > android:id="@+id/scanView" > > android:orientation="vertical"> > > <TextView > > android:layout_height="wrap_content" > > > > android:layout_width="wrap_content" android:text="@string/ > > scan_btn_txt" > > > > android:id="@+id/scanTextView"></TextView> > > <Button > > android:layout_height="wrap_content" > > > > android:layout_width="wrap_content" android:text="@string/ > > scan_btn_lbl" > > > > android:id="@+id/scanButton"></Button> > > </LinearLayout> > > > <LinearLayout > > xmlns:android="http://schemas.android.com/apk/res/ > > android" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > android:id="@+id/dataformView" > > android:orientation="vertical"> > > <Button > > android:layout_width="wrap_content" > > > > android:layout_height="wrap_content" android:text="@string/ > > pic_btn_lbl" > > > > android:id="@+id/photoButton"></Button> > > <TextView > > android:layout_width="wrap_content" > > > > android:layout_height="wrap_content" android:id="@+id/ > > pic_btn_lbl" > > > > android:text="@string/notes_txt"></TextView> > > <EditText android:text="EditText" > > android:id="@+id/notesEditText" > > android:layout_height="200dip" > > android:layout_width="wrap_content"></EditText> > > <Button > > android:layout_width="wrap_content" > > > > android:layout_height="wrap_content" android:id="@+id/button1" > > > > android:text="@string/save_data"></Button> > > </LinearLayout> > > </FrameLayout> > > > </TabHost> > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

