eluleci / FlatUI

Android FlatUI Kit
1.66k stars 422 forks source link

Dynamically adding FlatButton causes NPE #22

Closed jaredrummler closed 10 years ago

jaredrummler commented 10 years ago

The following code will result in a NullPointerException: FlatButton flatButton = new FlatButton(context);

In FlatButton#init() I added the following code to get it working:

if (attributes == null) {
    attributes = new Attributes(this);
    attributes.setColors(getResources().getIntArray(Attributes.DEFAULT_THEME));
}

I barely started messing around with your fantastic library but thought it would be great to add support to dynamically add views. My solution probably isn't the best.

eluleci commented 10 years ago

Thanks for notifying me. I fixed this bug with version 2.1.1 and pushed to Maven several minutes ago. Should be available in an hour. Sorry for late reaction. And I am really happy that you liked the library :) Cheers!