Set Background color programmatically [duplicate]

I try to set background color programmatically but when I set every one of my colors, the background being black but with any color background being white like the application theme.

View someView = findViewById(R.id.screen);
View root = someView.getRootView();
root.setBackgroundColor(color.white);

Can you see the code?


I didn't understand your question ... what do you mean by "when i set every one of my colour"? try this (edit: "#fffff" in original answer changed to "#ffffff"

  yourView.setBackgroundColor(Color.parseColor("#ffffff"));

you need to use getResources() method, try to use following code

View someView = findViewById(R.id.screen);
View root = someView.getRootView();
root.setBackgroundColor(getResources().getColor(color.white)); 

Edit::

getResources.getColor() is deprecated so, use like below

 root.setBackgroundColor(ContextCompat.getColor(this, R.color.white));