Android - Tabhost working in Activity class

前端 未结 7 949
温柔的废话
温柔的废话 2020-12-09 12:28

OK, I must be overlooking something silly because I am unable to get my tabhost to display in my Activity class. I am getting the dreaded force close when I try to run the

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 12:35

    Had the same problem: this question helps Android: TabHost without TabActivity

    Apparently, you only need to add one line:

    LocalActivityManager mLocalActivityManager = new LocalActivityManager(this, false);
    mLocalActivityManager.dispatchCreate(savedInstanceState);
    host.setup(mLocalActivityManager);
    

提交回复
热议问题