I am having a serious problem in my project and it is affecting several users using android <21. I change the colors of my navigationView however when using android <21 the application throws an exception. Larger versions work normally.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
navigationView.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(context, ThemeUtil.getThemeList().get(mTheme).getPrimaryColor())));
}else {
((TintableBackgroundView)navigationView).setSupportBackgroundTintList(ColorStateList.valueOf(tintColor));
}
Problem is in this line:
((TintableBackgroundView) navigationView) .setSupportBackgroundTintList (ColorStateList.valueOf (tintColor));
How can I use setSupportBackgroundTintList in navigationView?