본문 바로가기

나의 플랫폼/안드로이드

cannot be cast to android.widget.HeaderViewListAdapter

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
mListView.addFooterView(mFooterView);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN)
mListView.setAdapter(mAdapter);
mListView.removeFooterView(mFooterView);


API16 버전에서 위와 같은 순서대로 해야 문제가 안 생깁니다.


1. (ListView).addFooterView(FooterView)를 할 경우, (ListView).setAdapter를 한번 호출해야 추가 된다.

2. removeFooterView를 호출하기 전에 (ListView).setAdapter를 호출 해야 Exception이 발생 하지 않는다.


참고하세요.


참고:http://stackoverflow.com/questions/4404177/classcastexception-with-listview-when-executing-notifydatasetchanged


## 이블로그는 어디까지는 찾았던 부분을 잊지 않기 위해 올려놓은 것 입니다.

    내용이 부실해도 이해해 주시길 바랍니다.