Indexoutofboundsexception with listview

后端 未结 5 353
抹茶落季
抹茶落季 2020-12-21 06:28

I just got a strange indexoutofboundsexception that I can\'t seem to reproduce. It seems to be related to my listactivity:

java.lang.IndexOutOfBoundsExceptio         


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-21 06:53

    @Kevin Qiu the hint to hide stuff helped. I only had to hide the headerview, not the whole list. Here's the code that worked for me, assuming that the header view is named mHeaderView
    @Override public void onStop() { super.onStop(); mHeaderView.setVisibility(View.GONE);// fixes weird bug with header view }

    And to Make sure it shows up after you switch to a different app, do the code below.
    @Override public void onStart() { if(mHeaderView.getVisibility() == View.GONE) mHeaderView.setVisibility(View.VISIBLE); super.onStart(); }

提交回复
热议问题