Reputation: 5
I'm trying to add two buttons to the bottom of the list view with:
footerView = ((LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.page_navigation, null, false);
listView = (ListView) findViewById(R.id.list);
listView.addFooterView(footerView);
to this point i have no problem but when i trying to manipulate the visibility of elements of the footerview
i'm getting a null pointer exception. according to answers in the other questions maybe using fragments is a better solution. any idea how to do that
nextPage = (Button) findViewById(R.id.next);
previousPage = (Button) findViewById(R.id.prev);
mainNav = (Button) findViewById(R.id.previousNext);
above buttons are footerView
elements and i'm trying to control the visibility of them and updating the listView
items in response to click of this buttons (i mean is callback to this buttons available?)
thanks in advance and excuse me for poor english
Upvotes: 0
Views: 201
Reputation: 6179
Try
nextPage = (Button) footerView.findViewById(R.id.next);
previousPage = (Button) footerView.findViewById(R.id.prev);
mainNav = (Button) footerView.findViewById(R.id.previousNext);
Upvotes: 1