Setting LinearLayout background on activity launch

Just came across an issue where on one device (HTC Desire X) I was unable to set the background resource for the root LinearLayout of my activity’s view, even though it worked fine on multiple other devices. The code I was using:

setContentView(R.layout.background);
LinearLayout appBackground = (LinearLayout)findViewById(R.id.appBackground);
appBackground.setBackgroundResource(someResourceId);

The above code was called from onCreate(), and a call to invalidate() didn’t help. To fix it I had to post a delayed runnable to set the background a little later:

setContentView(R.layout.background);

new Handler().postDelayed(new Runnable() {
  @Override
  public void run() {
    LinearLayout appBackground = (LinearLayout)findViewById(R.id.appBackground);
    appBackground.setBackgroundResource(backgroundResourceId);
  }
}, 200);

Yes it sucks, but it works and the delay is not noticable. Variation between Android devices sucks :S