Issue
Wanted to ask. What is the right way to use VectorDrawable from resources?
with support library compile 'com.android.support:support-v4:25.1.1'
Because getDrawable() is deprecated and when I use ContextCompat.getDrawable(this, R.drawable.ic_cancel_button);
for setting toolbar navigation image like this
if(toolbar != null)
{
toolbar.setNavigationIcon(ContextCompat.getDrawable(this, R.drawable.ic_cancel_button));
}
The error occures.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_cancel_button.xml from drawable resource ID #0x7f02005e
Solution
Have a look at AppCompatResources.getDrawable(Context context, @DrawableRes int resId)
.
Answered By - azizbekian
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.