title: Android - Changing background every 5 seconds
body: <p>I have this code in an attempt to have my app change it's background every 5 seconds, however, it only displays the first image in my array. Is there a simple tweak to this I can make so it will run through the 5 different images continuously??</p>
  
  <p>Here is what I have in my MainActivity.class</p>
  
  <pre><code>    int count=0; //outside oncreate
  
      //all that is below is within oncreate
      final int[] drawablearray=new int[]{R.drawable.one,R.drawable.two,R.drawable.three,R.drawable.four,R.drawable.five};
      new Handler().postDelayed(new Runnable() {
          public void run() {
             if(count&lt;drawablearray.length){
                 MainActivity.this.getWindow().
                 setBackgroundDrawableResource(drawablearray[count]);
                 count++;
              }
             else{
                count=0;
              }
            }
        }, 5000);
  </code></pre>
  
  <p>Thanks for all and any help!!</p>