Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in every ListView and its adapter #1

Open
korrio opened this issue Aug 10, 2015 · 1 comment
Open

Error in every ListView and its adapter #1

korrio opened this issue Aug 10, 2015 · 1 comment

Comments

@korrio
Copy link

korrio commented Aug 10, 2015

Caused by: java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called. at android.widget.ListView.addHeaderView(ListView.java:255) at android.widget.ListView.addHeaderView(ListView.java:284) at com.tuesda.watch.activities.UsersActivity.initView(UsersActivity.java:96) at com.tuesda.watch.activities.UsersActivity.onCreate(UsersActivity.java:76)

caused from this code

    mList.setAdapter(mUsersAdapter);
    mList.setDivider(null);
    ....
    mList.addHeaderView(mHeader); // <--
@tuesda
Copy link
Owner

tuesda commented Aug 10, 2015

这个貌似是在api17及以下会出现的错误。具体可参考:http://blog.csdn.net/mtt1987/article/details/38535249
我会修改下代码。
谢谢反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants