I have an activity with a background:
In java we do like this
Give id to LinearLayout
Then in code
LinearLayout layout=(LinearLayout)findViewById(R.id.parentLayout); layout.setBackgroundColor(Color.BLUE); Or layout.setBackgroundDrawable(d); Or layout.setBackgroundResource(resid);