Denys
Denys

Reputation: 4557

addFooterView for a ListView that is defined in the xml

I've got a ListView, which is fully defined in the xml file. Now I want to add a footer to thi s list so that the last element of the list became a button.

So firstly I do this: View v = getLayoutInflater().inflate(R.layout.add_new, null);, where add_new is the layout for my footer

Now I know that I need to do smth like this: listViewInstance.addFooterView(v);

But i dont really have that instance as my ListView is defined in an xml file. So what do I write instead of listViewInstance? Is there a way to get its instance somehow from an xml?

Thanks in advance xxx

Upvotes: 0

Views: 172

Answers (1)

Diego Torres Milano
Diego Torres Milano

Reputation: 69208

Use ListActivity.getListView() if you are using a ListActivity or Activity.findViewById() to get the reference to the list view otherwise.

Upvotes: 1

Related Questions