Android int color = contextcompat.getColor (getContext (), mcolorResourceID);

LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear);
int color = ContextCompat.getColor(getContext(), mColorResourceId);
linearLayout.setBackgroundColor(color);
Ismail Hossain