android - adding a linear layout defined in xml at the footer of listview -
i trying add linear layout defined in xml @ footer of listview. tried below code
listview.addfooter(findviewbyid(r.id.my_linearlayout))
but throwing error
java.lang.nullpointerexception: attempt invoke virtual method 'android.view.viewgroup$layoutparams android.view.view.getlayoutparams()' on null object reference
if remove addfooter code acitvity runs smoothly.can 1 please suggest issue or if right way add linearlayout @ footer of listview dynamically. in advance.
view footerview = getlayoutinflater().inflate(r.layout.my_linearlayout, null); listview.addfooterview(footerview);
you should add my_linearlayout /res/layout/ folder.
Comments
Post a Comment