java - Android list footer -


i null pointer exception @ line five/seven of code:

    layoutinflater inflater = getlayoutinflater();     view header = inflater.inflate(r.layout.footer_row, (viewgroup) findviewbyid(r.id.header_layout_root));     textview tv_footer = (textview) findviewbyid(r.id.tv_footertext);     if(getlistview().getcount()<=8) {         tv_footer.settext("you have no more assignments");     } else {         tv_footer.settext(integer.tostring(getlistview().getcount()) + " assignments shown");     }     getlistview().addfooterview(header, null, false); 

i'm not sure why, tell me? list view's aren't thing.

i'll tick right answer!

instead of using findviewbyid() method activity's view should assign (which assume footer textview in r.layout.footer_row) textview inflated view.

sample code:

textview tv_footer = (textview) header.findviewbyid(r.id.tv_footertext); 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -