Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawables returning as null #99

Closed
MatthewBooth opened this issue Aug 7, 2015 · 5 comments
Closed

Drawables returning as null #99

MatthewBooth opened this issue Aug 7, 2015 · 5 comments

Comments

@MatthewBooth
Copy link

Using the below code:

menuItem.setIcon(new IconDrawable(this, Iconify.IconValue.fa_refresh)
                .colorRes(typedArray.getResourceId(0, Color.BLACK))
                .sizeDp(16));

As of 1.0.10 for some reason this returns null and throws an exception. If I replace that with a resource id (R.drawable.something_here) the icon (something_here) shows. So I've narrowed this down exactly to Iconify. The same code was working before 1.0.10, but I was forced to update to 1.0.10 due to a missing font, for whatever reason that happened.

@MatthewBooth
Copy link
Author

Where are my manners, here's a snippet of the logcat

 java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable()' on a null object reference
            at android.support.design.internal.NavigationMenuItemView.setIcon(NavigationMenuItemView.java:113)
            at android.support.design.internal.NavigationMenuItemView.initialize(NavigationMenuItemView.java:72)
            at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.getView(NavigationMenuPresenter.java:305)
            at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
            at android.widget.AbsListView.obtainView(AbsListView.java:2347)
            at android.widget.ListView.makeAndAddView(ListView.java:1864)

@MatthewBooth
Copy link
Author

The typedArray works fine, btw, also. Just ruling that out.

@MatthewBooth
Copy link
Author

Nevermind, this was fixed by reverting to support libraries: 22.2.0. My bad.

@JoanZapata
Copy link
Owner

#93 for reference.

@MatthewBooth
Copy link
Author

How on earth did I miss #93 :/

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants