Replace this line :
getResources().getDrawable(R.drawable.your_drawable)
with ResourcesCompat.getDrawable(getResources(), R.drawable.your_drawable, null)
EDIT
ResourcesCompat
is also deprecated now. But you can use this:
ContextCompat.getDrawable(this, R.drawable.your_drawable)
(Here this
is the context)
for more details follow this link: ContextCompat