johannilsson / android-actionbar

DEPRECATED Android Action Bar Implementation
1.31k stars 564 forks source link

How to instantiate ActionBar in code without xml? #76

Closed Windol closed 11 years ago

Windol commented 11 years ago

I need to dynamically instantiate the class ActionBar using parameters stored in the database. The problem is that to create a new instance of the class ActionBar need an interface instance attributeSet and I could not any way to create this instance without the need for an XML.

AttributeSet attributeSet = ???; ActionBar actionBar = new ActionBar(this, attributeSet);

johannilsson commented 11 years ago

Hi, AttributeSet is not required for the constructor of the RealtiveLayout which ActionBar extends. You could try to add a new constructor that only takes Context in which the title is not set.

Windol commented 11 years ago

Thanks for the tip johannilsson, helped a lot!