EDIT: Sorry I realise from your comment my question was not clear enough. I will post a new one. Sorry for this and thanks for your answers
I am populat
Now as getDrawable
and setBackgroundDrawable
both are depricated
you should set drawable as Background like this :
view.setBackground(ContextCompat.getDrawable(this, R.drawable.your_drawable));
and if you are targating minSdk below 16 then make a check like this :
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
view.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.your_drawable));
} else {
view.setBackground(ContextCompat.getDrawable(this, R.drawable.your_drawable));
}