JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 527 forks source link

NPE when calling getTypeFace #135

Closed Orbyt closed 8 years ago

Orbyt commented 8 years ago

Im simply trying to use this to create drawables to set as tab icons. I have Iconify.with() in my application class, and am using this for setting the icons:

tabLayout.getTabAt(0).setIcon(new IconDrawable(this, FontAwesomeIcons.fa_share));

Getting this npe:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Typeface com.joanzapata.iconify.internal.IconFontDescriptorWrapper.getTypeface(android.content.Context)' on a null object reference at com.joanzapata.iconify.IconDrawable.init(IconDrawable.java:63) at com.joanzapata.iconify.IconDrawable.(IconDrawable.java:56)

Any ideas on what might be causing this?

Svantulden commented 8 years ago

Try using Iconify.with(new FontAwesomeModule());. I had this error too when I tried to use an IonIcons icon. I forgot to call Iconify.with(new IoniconsModule()); also.

JoanZapata commented 8 years ago

Thanks @Svantulden. I added an explicit error message in case the module was not loaded.