I’m trying to use the requestWindowFeature() function to set a custom title view on a list activity. The method works fine with a view that only subclasses Activity, but whenever I try the same method with a ListActivity subclass, it errors, giving me a NullPointerException when I try to programmatically modify the title view.
I believe the problem pertains to the fact that requestWindowFeature() needs to be called before setContentView(). Because ListActivity takes care of setting the content view for you, I don’t know when that is being called. Does anyone have any suggestions? Thanks for the help.
setContentView is called whenever you interact with the List, for example calling getList() or setAdapter() on listactivity. See the source of listactivity