Issues with Android TabHost Example

前端 未结 4 1241
别那么骄傲
别那么骄傲 2020-11-30 07:07

I have been attempting to implement the \'advanced\' tabwidget example from google. But, when it tries to call tabHost.addTab(spec); I get a stack trace from t

4条回答
  •  日久生厌
    2020-11-30 07:40

    The current TabHost Example on the Android Developers site contains one error and also leaves out an important step that will prevent the example from running.

    First off: In the onCreate() method that is added to HelloTabWidget class attempts to use a TabHost object called mTabHost. This is invalid, it should be tabHost.

    Second: The tutorial leaves out the details that you need to add each of the activities too the AndroidManifest.xml. Without this the code will not work and you will get "force close" each time you attempt to execute.

提交回复
热议问题