AndroidDeveloperLB/MaterialPreferenceLibrary

preference.getIcon() referencing a null object

Closed this issue · 5 comments

I tried to tint the peference icon:

<com.lb.material_preferences_library.custom_preferences.Preference
    android:summary="@string/scanmode_sum"
    android:key="scanmode"
    app:icon="@drawable/ic_scan"/>

and getting:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setTint(int)' on a null object reference

You need to use "getIconCompat" , because "getIcon" is used only on the normal Preference class.
Maybe I should deprecate the original one.

@Tomblarom Does it work fine now for you?

I didn't test it yet. I'll give a reply soon :)

But you closed the issue...

If you've checked this issue, please close it.