title: Dynamic background based on a timer (linear layout), how to?
body: <p>Hi I'm kind of beginner to android OS programming, and I got stuck with a problem, I cant figure out how to do a dynamic background, based on timers (say each 10 seconds a background changes to a different one) I have some code but it comes up with error, here's a sample:</p>
  
  <pre><code>private static final long GET_DATA_INTERVAL = 10000;
  int images[] = {R.drawable.smothie1,R.drawable.omletherb1};
  int index = 0;
  ImageView img;
  Handler hand = new Handler();
  
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      this.setContentView(R.layout.main);
      LinearLayout layout= (LinearLayout)findViewById(R.id.LinearView1);
      hand.postDelayed(run, GET_DATA_INTERVAL);
  }
  
  Runnable run = new Runnable() {
      public void run() {
          layout.setBackgroundResource(LinearView1).getDrawable(images[index++]);
          if (index == images.length)
              index = 0;
          hand.postDelayed(run, GET_DATA_INTERVAL);
  </code></pre>
  
  <p>Any help would be greatly apprieciated :D thanks</p>
  
  <p><strong>EDIT</strong>: The errors I get are on this line:</p>
  
  <pre><code>layout.setBackgroundResource(LinearView1).getDrawable(images[index++]);
  </code></pre>
  
  <p>It says that:</p>
  
  <p>-layout cannot be resolved</p>
  
  <p>-the method getDrawable(int) is undefined for the type Object</p>
  
  <hr>
  
  <p>This error:</p>
  
  <pre><code>layout.setBackgroundResource(LinearView1).getDrawable(images[index++]);
  </code></pre>
  
  <p>It says that:</p>
  
  <p>-layout cannot be resolved</p>
  
  <p>-the method getDrawable(int) is undefined for the type Object</p>
  
  <p>Please help :)</p>