0

I am brand new to android development and the code crashes at the setContentView(R.layout.main). I don't know why. I have tried the standard clean and build and restarting eclipse.

Main Code:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

}

Main.xml Code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <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">
            <View android:layout_width="fill_parent" android:layout_height="0.5dip"
                android:background="#000" />
            <TabWidget android:id="@android:id/tabs"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_marginLeft="0dip" android:layout_marginRight="0dip" />
            <View android:layout_width="fill_parent" android:layout_height="2dip"
                android:background="#696969" />
            <View android:layout_width="fill_parent" android:layout_height="2dip"
                android:background="#000" />
            <FrameLayout android:id="@android:id/tabcontent"
                android:layout_width="fill_parent" android:layout_height="fill_parent" />
        </LinearLayout>
    </TabHost>

</LinearLayout>
Bryan1234321
  • 63
  • 1
  • 6

1 Answers1

2

Remove xmlns from TabHost. There should only be one xmlns in layout xml file.

<TabHost
    android:id="@android:id/tabhost" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
PH7
  • 3,926
  • 3
  • 24
  • 29
  • xmlns attributes meant only for root layout. Any misplaced xmlns attributes should be removed from the layout file. As I put in the code, you just need to replace your – PH7 Oct 14 '11 at 00:37
  • I took out the xmins and sadly the app still crashes when it launches. Is there anything else that could be going wrong. – Bryan1234321 Oct 14 '11 at 00:47
  • Still crashing? From my knowledge, that is the only error so far. Let me know if u need more help. – PH7 Oct 14 '11 at 01:15
  • btw, it is not xmins. It is xmlns. – PH7 Oct 14 '11 at 01:50