http://stackoverflow.com/questions/4393775/android-classcastexception-when-adding-a-header-view-to-expandablelistview helped me out with addHeaderView() and the infamous ClassCastException.
Basically you do TopSearch.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.FILL_PARENT, ListView.LayoutParams.WRAP_CONTENT)); right before lv.addHeaderView(TopSearch); Regards On Dec 10, 5:37 pm, bobetko <bobe...@gmail.com> wrote: > I have added a view to the header of my ListView by following way: > > ListView lv = (ListView)getListView(); > View TopSearch = (View) View.inflate(this, R.layout.search, > null); > lv.addHeaderView(TopSearch, null, false); > > And everything is fine until I make changes to data adapter and then > try to execute: > > adapter.notifyDataSetChanged(); > > This always crashes my application giving me following error: > > "java.lang.ClassCastException: android.widget.HeaderViewListAdapter" > > If I don't add header view to my list view, then everything works fine > with no errors > Any suggestions? > > Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en